commit_natalia
This commit is contained in:
parent
1227058e70
commit
25c68df0f4
@ -5,7 +5,7 @@
|
|||||||
<excludeFolder url="file://$MODULE_DIR$/Restaurant/Marta/venv" />
|
<excludeFolder url="file://$MODULE_DIR$/Restaurant/Marta/venv" />
|
||||||
<excludeFolder url="file://$MODULE_DIR$/venv" />
|
<excludeFolder url="file://$MODULE_DIR$/venv" />
|
||||||
</content>
|
</content>
|
||||||
<orderEntry type="jdk" jdkName="Python 3.7" jdkType="Python SDK" />
|
<orderEntry type="jdk" jdkName="Python 3.7 (projekt_sztuczna)" jdkType="Python SDK" />
|
||||||
<orderEntry type="sourceFolder" forTests="false" />
|
<orderEntry type="sourceFolder" forTests="false" />
|
||||||
</component>
|
</component>
|
||||||
<component name="TestRunnerService">
|
<component name="TestRunnerService">
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.7" project-jdk-type="Python SDK" />
|
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.7 (projekt_sztuczna)" project-jdk-type="Python SDK" />
|
||||||
</project>
|
</project>
|
100
Restaurant/Natalia/Nowy.csv
Normal file
100
Restaurant/Natalia/Nowy.csv
Normal file
@ -0,0 +1,100 @@
|
|||||||
|
20,0,2,4,3,2
|
||||||
|
57,0,8,2,1,2
|
||||||
|
50,1,3,4,1,1
|
||||||
|
51,1,6,1,1,1
|
||||||
|
82,1,9,1,2,2
|
||||||
|
73,1,5,4,3,2
|
||||||
|
65,0,7,3,2,1
|
||||||
|
16,1,9,2,3,1
|
||||||
|
23,0,1,4,3,1
|
||||||
|
74,0,10,3,1,1
|
||||||
|
85,1,5,4,1,2
|
||||||
|
35,0,2,1,2,1
|
||||||
|
79,1,9,4,1,2
|
||||||
|
56,0,7,2,1,2
|
||||||
|
51,0,6,4,3,2
|
||||||
|
13,1,8,1,3,1
|
||||||
|
30,0,8,2,2,2
|
||||||
|
50,0,5,5,1,2
|
||||||
|
39,1,9,3,3,1
|
||||||
|
20,0,7,5,3,1
|
||||||
|
63,1,8,4,1,1
|
||||||
|
74,1,2,1,3,1
|
||||||
|
46,1,7,3,1,2
|
||||||
|
52,0,5,3,3,1
|
||||||
|
39,0,9,1,3,1
|
||||||
|
14,1,4,1,3,2
|
||||||
|
81,1,2,1,3,1
|
||||||
|
79,0,10,4,1,2
|
||||||
|
69,0,1,5,1,2
|
||||||
|
87,1,3,4,3,2
|
||||||
|
72,1,9,1,3,1
|
||||||
|
85,0,5,4,1,2
|
||||||
|
59,1,10,5,3,1
|
||||||
|
32,1,8,1,3,1
|
||||||
|
28,0,3,1,1,2
|
||||||
|
77,0,10,3,1,1
|
||||||
|
82,1,4,5,3,2
|
||||||
|
30,0,9,1,3,2
|
||||||
|
83,1,9,2,3,2
|
||||||
|
88,1,2,3,2,1
|
||||||
|
72,1,8,3,2,1
|
||||||
|
87,1,9,2,2,2
|
||||||
|
13,0,8,5,2,1
|
||||||
|
47,0,6,3,1,2
|
||||||
|
51,1,1,4,3,1
|
||||||
|
27,0,4,5,2,2
|
||||||
|
50,1,7,5,1,2
|
||||||
|
16,1,2,4,2,2
|
||||||
|
29,0,8,4,3,2
|
||||||
|
80,1,2,3,2,1
|
||||||
|
16,0,10,2,1,1
|
||||||
|
76,0,4,4,3,2
|
||||||
|
44,1,6,1,1,2
|
||||||
|
63,0,5,2,2,2
|
||||||
|
12,1,5,4,3,2
|
||||||
|
73,1,1,5,1,2
|
||||||
|
39,1,7,3,3,1
|
||||||
|
10,0,8,3,1,2
|
||||||
|
32,0,7,4,3,1
|
||||||
|
32,0,8,1,2,1
|
||||||
|
74,1,2,4,1,2
|
||||||
|
77,1,9,1,3,1
|
||||||
|
13,1,2,1,1,1
|
||||||
|
61,0,10,1,1,2
|
||||||
|
48,1,2,1,1,1
|
||||||
|
11,0,4,5,3,1
|
||||||
|
80,0,10,3,3,1
|
||||||
|
33,0,9,5,3,2
|
||||||
|
53,1,5,2,3,2
|
||||||
|
56,0,10,2,2,2
|
||||||
|
25,1,4,4,1,2
|
||||||
|
27,0,8,3,3,2
|
||||||
|
83,0,1,1,1,2
|
||||||
|
49,0,4,3,2,2
|
||||||
|
76,0,10,3,1,1
|
||||||
|
40,0,1,5,2,2
|
||||||
|
73,1,3,4,2,1
|
||||||
|
19,1,2,4,2,2
|
||||||
|
77,1,7,2,3,1
|
||||||
|
52,0,5,4,3,2
|
||||||
|
29,0,10,2,3,1
|
||||||
|
28,1,5,1,3,2
|
||||||
|
63,0,1,5,3,2
|
||||||
|
84,1,4,2,1,2
|
||||||
|
31,0,9,1,3,1
|
||||||
|
46,1,3,5,1,1
|
||||||
|
84,0,6,5,3,1
|
||||||
|
30,0,7,1,2,2
|
||||||
|
29,1,7,1,1,1
|
||||||
|
46,1,5,3,3,2
|
||||||
|
17,1,8,1,1,1
|
||||||
|
37,0,10,4,2,1
|
||||||
|
43,0,6,1,3,1
|
||||||
|
57,1,6,1,2,2
|
||||||
|
58,1,4,1,3,2
|
||||||
|
59,0,1,4,3,1
|
||||||
|
26,0,7,2,3,2
|
||||||
|
43,0,2,1,3,1
|
||||||
|
66,0,8,2,1,1
|
||||||
|
85,1,2,1,2,2
|
|
54
Restaurant/Natalia/Tree_natalia
Normal file
54
Restaurant/Natalia/Tree_natalia
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
# Load libraries
|
||||||
|
import pandas as pd
|
||||||
|
from sklearn.tree import DecisionTreeClassifier # Import Decision Tree Classifier
|
||||||
|
from sklearn.model_selection import train_test_split # Import train_test_split function
|
||||||
|
from sklearn import metrics #Import scikit-learn metrics module for accuracy calculation
|
||||||
|
from sklearn.tree import export_graphviz
|
||||||
|
from sklearn.externals.six import StringIO
|
||||||
|
from IPython.display import Image
|
||||||
|
import pydotplus
|
||||||
|
|
||||||
|
col_names = ['age', 'sex', 'fat', 'spicy', 'hungry', 'budget']
|
||||||
|
# load dataset
|
||||||
|
pima = pd.read_csv("nazwa.csv", header=None, names=col_names)
|
||||||
|
|
||||||
|
#split dataset in features and target variable
|
||||||
|
feature_cols = ['age', 'sex', 'fat', 'spicy']
|
||||||
|
X = pima[feature_cols] # Features
|
||||||
|
y = pima.label # Target variable
|
||||||
|
|
||||||
|
# Split dataset into training set and test set
|
||||||
|
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.3, random_state=1) # 70% training and 30% test
|
||||||
|
|
||||||
|
# Create Decision Tree classifer object
|
||||||
|
clf = DecisionTreeClassifier()
|
||||||
|
|
||||||
|
# Train Decision Tree Classifer
|
||||||
|
clf = clf.fit(X_train,y_train)
|
||||||
|
|
||||||
|
#Predict the response for test dataset
|
||||||
|
y_pred = clf.predict(X_test)
|
||||||
|
|
||||||
|
# Model Accuracy, how often is the classifier correct?
|
||||||
|
print("Accuracy:",metrics.accuracy_score(y_test, y_pred))
|
||||||
|
|
||||||
|
dot_data = StringIO()
|
||||||
|
export_graphviz(clf, out_file=dot_data,
|
||||||
|
filled=True, rounded=True,
|
||||||
|
special_characters=True,feature_names = feature_cols,class_names=['0','1'])
|
||||||
|
graph = pydotplus.graph_from_dot_data(dot_data.getvalue())
|
||||||
|
graph.write_png('food_tree.png')
|
||||||
|
Image(graph.create_png())
|
||||||
|
|
||||||
|
|
||||||
|
# Create Decision Tree classifer object
|
||||||
|
clf = DecisionTreeClassifier(criterion="entropy", max_depth=3)
|
||||||
|
|
||||||
|
# Train Decision Tree Classifer
|
||||||
|
clf = clf.fit(X_train,y_train)
|
||||||
|
|
||||||
|
#Predict the response for test dataset
|
||||||
|
y_pred = clf.predict(X_test)
|
||||||
|
|
||||||
|
# Model Accuracy, how often is the classifier correct?
|
||||||
|
print("Accuracy:",metrics.accuracy_score(y_test, y_pred))
|
0
Restaurant/Natalia/__init__.py
Normal file
0
Restaurant/Natalia/__init__.py
Normal file
Loading…
Reference in New Issue
Block a user