Classification using python
import pandas as pd import numpy as np from sklearn.model_selection import train_test_split from sklearn.tree import DecisionTreeClassifier # Load the data df = pd.read_csv( 'data.csv' ) # Split the data into train and test sets X_train, X_test, y_train, y_test = train_test_split(df.drop( 'target' , axis= 1 ), df[ 'target' ], test_size= 0.25 ) # Create the model model = DecisionTreeClassifier() # Fit the model to the training data model.fit(X_train, y_train) # Predict the labels for the test data y_pred = model.predict(X_test) # Evaluate the model accuracy = np.mean(y_pred == y_test) print( 'Accuracy:' , accuracy)