From Tyler’s project:
Anaconda
Python Machine Learning: Input the info output the result? need training data EXAMPLE FROM ONLINE: // 0 == bumpy, 1 == smooth // 0 == apple, 1 == orange import sklearn import tree features = [[140, 1], [130, 1], [150, 0], [170, 0]] labels = [0, 0, 1, 1] clf = tree.DecisionTreeClassifier() clf = clf.fit(features, labels) print clf.predict([[150, 0]]) //ACTUAL THING (I THINK): //adidas bought Reebok, making it hard to track the difference as Adidas now gets the benefits Reebok had //also Reebok did not make stock public until 2007, right after their last contract went into effect import sklearn import tree contracts = [["NFL 2012", "", "NBA 2012-2025", ""], ["NFL 2002-2012", "NHL 2007-2024", "NBA 2006-2017", ""], ["", "", "", "MLB 2005-2020"], ["", "", "", "MLB 2020-2030"]] labels = ["Nike", "Adidas", "Majestic", "Under Armour"] //prices on August 1 from 2007 to present years = [2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016] prices = [[14.09, 15.15, 13.85, 17.50, 21.66, 24.34, 31.41, 39.28, 112.62, 57.64], [29.45, 29.45, 23.64, 25.35, 34.91, 39.04, 53.04, 37.40, 37.50, 83.14], [3.11, 3.38, 2.02, 4.64, 24.01, 19.73, 14.21, 10.24, 3.39, 12.02], [8.13, 4.21, 2.98, 4.48, 8.86, 14.55, 18.16, 34.18, 47.76, 39.63]] peakdate = ["Aug 1 2015", "Apr 1 2017", "Aug 1 2011", "Jul 1 2015"] peak = [112.62, 100.30, 24.01, 49.67] effectivecontracts = [[2012, 2024], [2002, 2024], [2005, 2020], [2020, 2030]] currentprice = [51.52, 96.37, 9.18, 19.34] difference = currentprice - peak clf = tree.DecisionTreeClassifier() clf = clf.fit(difference, effectivecontracts, labels) print clf.predict([[-30.33], [2020-2030]])