Skip to content

Instantly share code, notes, and snippets.

@Remonhasan
Last active September 25, 2019 05:10
Show Gist options
  • Save Remonhasan/68facb91cde6ad714b6de3b6b37f210d to your computer and use it in GitHub Desktop.
Save Remonhasan/68facb91cde6ad714b6de3b6b37f210d to your computer and use it in GitHub Desktop.
Algorithm: AppleWatch dataset with DecisionTree / research
# Author Remon Hasan, University of Asia Pacific
# Applewatch dataset solve with supervised way
# implementation with google Colab
import pandas as pd
import numpy as np
applewatch= pd.read_csv('AppleWatch.csv')
# lebel
train = applewatch.drop('Heart',axis=1)
y= applewatch["Heart"]
x=train.drop(['Activity','Gender'], axis=1)
total = [x,y]
# import libarry
from sklearn.model_selection import train_test_split
from sklearn.tree import DecisionTreeClassifier
x_train, x_test, y_train, y_test = train_test_split(x,y,test_size=.20,random_state=1)
x_train.shape, y_train.shape
clf = DecisionTreeClassifier(random_state=1)
clf.fit(x_train, y_train)
predictions = clf.predict(x_test)
print(predictions)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment