-
Notifications
You must be signed in to change notification settings - Fork 50
/
Copy pathlotto2.py
30 lines (27 loc) · 1.21 KB
/
lotto2.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
from sklearn import tree
import pandas as pd
data = pd.read_csv('thLotto_49-59.csv')
day = list(zip(data['day'],data['month'],data['year']))
first = data['first']
digit3 = data['3digit']
last_2digit_top = data['last_2digit_top']
first_3digit_1 = data['first_3digit_1']
first_3digit_2 = data['first_3digit_2']
last_3digit_1 = data['last_3digit_1']
last_3digit_2 = data['last_3digit_2']
last_2digit_down = data['last_2digit_down']
iD = int(input("Day: "))
iM = int(input("Month: "))
iY = int(input("Year: "))
def perdictLotto(d,m,y,data1,data2):
classifier = tree.DecisionTreeClassifier()
classifier.fit(data1,data2)
return classifier.predict([[d,m,y]])[0]
print("\nFirst: %06d"%perdictLotto(iD,iM,iY,day,first))
print("Three digit: %03d"%perdictLotto(iD,iM,iY,day,digit3))
print("The first three digits: %03d"%perdictLotto(iD,iM,iY,day,first_3digit_1))
print(" %03d"%perdictLotto(iD,iM,iY,day,first_3digit_2))
print("The last three digits: %03d"%perdictLotto(iD,iM,iY,day,last_3digit_1))
print(" %03d"%perdictLotto(iD,iM,iY,day,last_3digit_2))
print("Two digits: %02d"%perdictLotto(iD,iM,iY,day,last_2digit_top))
print(" %02d"%perdictLotto(iD,iM,iY,day,last_2digit_down))