machine learning error (using jupyter) - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: machine learning error (using jupyter) (/thread-19391.html) |
machine learning error (using jupyter) - calonia - Jun-26-2019 i was trying to play around with machine learning and make prediction on this data set using jupyter: https://github.com/dpkravi/DecisionTreeClassifier/blob/master/data.csv but i get errors. i don't know if my coding is flawed, or the data set isn't eligible or valid for machine learning. i am sorry for the inconvenience . i am a beginner in programing . import pandas from sklearn.tree import DecisionTreeClassifier from sklearn.model_selection import train_test_split from sklearn.metrics import accuracy_score isotope_data = pandas.read_csv('data.csv') x = isotope_data.drop(columns=['pH']) y = isotope_data['pH'] x_train, x_test, y_train, y_test = train_test_split(x, y, test_size=0.2) model = DecisionTreeClassifier() model.fit(x_train, y_train) predictions = model.predict(x_test) score = accuracy_score(y_test, predictions) score
RE: machine learning error (using jupyter) - ThomasL - Jun-26-2019 The column 'pH' is 'continuous' which means it consists of real numbers The target is supposed to be of a categorical class ['binary', 'multiclass', 'multiclass-multioutput', 'multilabel-indicator', 'multilabel-sequences'] for example like column 'quality' which is the label for this dataset. column 'pH' is a feature. |