diff --git a/Andrzej_Preibisz.md b/Andrzej_Preibisz.md index d94bb94..4d1cef2 100644 --- a/Andrzej_Preibisz.md +++ b/Andrzej_Preibisz.md @@ -57,7 +57,8 @@ i prawdopodobnie oznaczało overfitting drzewa. W przypadku głębokości chodzi Zastosowany zbiór uczący obejmuje 373 rekordy zapisane w formacie .csv, w którym poszczególne kolumny oznaczają odpowiednio: produkt, kategorię produktu, temperature na regale, wilgotność powietrza na danym regale, szansę że przedmiot po dłuższym czasie przechowywania będzie w dobrym stanie, oraz informację czy można bezpiecznie go tu położyć. Przykładowy rekord: ``frozen food,freezed,21, 0.5, 0.01, 0 `` . Zbiór testowy z kolei zawiera 26 rekordów w tym samym formacie. -Przygotowanie zbioru uczącego i testowego dla drzewa: \ +Zbiór uczący znajduje się w pliku package_location_classifier/trainset/trainset.csv, a testowy package_location/testset/testset.csv. +Przygotowanie zbioru uczącego i testowego dla drzewa: `` products = pd.read_csv("package_location_classifier/trainset/trainset.csv", header=0, sep=",", names=cols_names) testset = pd.read_csv("package_location_classifier/testset/testset.csv", header=None, sep=",", names=cols_names) @@ -71,6 +72,9 @@ Przygotowanie zbioru uczącego i testowego dla drzewa: \ X_train = pd.get_dummies(products[feature_cols]) y_train = products.chance_of_survive `` -Graficzna reprezentacja drzewa wygenerowanego dla tego zbioru uczącego: \ +Graficzna reprezentacja drzewa wygenerowanego dla tego zbioru uczącego: [Przykładowe drzewo](Drzewo.png) +Wyniki ewaluacji zestawu testowego, znajdujące się w pliku Test_results.xlsx: +[Wyniki testu](Test_Results.png) + diff --git a/Test_Results.png b/Test_Results.png new file mode 100644 index 0000000..f3e3dd2 Binary files /dev/null and b/Test_Results.png differ diff --git a/Test_results.xlsx b/Test_results.xlsx new file mode 100644 index 0000000..b459428 Binary files /dev/null and b/Test_results.xlsx differ diff --git a/package_location_classifier/classifier.py b/package_location_classifier/classifier.py index 525c2d5..6ade99b 100644 --- a/package_location_classifier/classifier.py +++ b/package_location_classifier/classifier.py @@ -47,12 +47,14 @@ class PackageLocationClassifier(): y_pred = self.predictor.predict(test_X) evaluation = pd.DataFrame({'category': testset.category, 'temperature': testset.temperature , 'humid': testset.humidity ,'Actual': test_y, 'Predicted': y_pred}) + evaluation = evaluation.round({'Actual': 3, 'Predicted': 3}) evaluation['Prediction_diff'] = abs(evaluation['Actual'] - evaluation['Predicted']) + evaluation.to_excel("Test_resultsv2.xlsx") print("Prediction differs from actual value by average {}".format(round(evaluation['Prediction_diff'].mean(), 2))) - export_graphviz(clf, out_file=data, filled=True, rounded=True, special_characters=True, feature_names=dummies_names) - graph = pydotplus.graph_from_dot_data(data.getvalue()) - graph.write_png('Drzewo.png') - Image(graph.create_png()) + # export_graphviz(clf, out_file=data, filled=True, rounded=True, special_characters=True, feature_names=dummies_names) + # graph = pydotplus.graph_from_dot_data(data.getvalue()) + # graph.write_png('Drzewo.png') + # Image(graph.create_png()) def check_if_can_place(self, package, tile): category = package.category