Last active
September 25, 2019 05:09
-
-
Save Remonhasan/b66bd5314782b6538c0650dbdcd78957 to your computer and use it in GitHub Desktop.
Algorithm: Applewatch dataset with LinearRegression / research
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Author Remon Hasan, University of Asia Pacific | |
# Applewatch dataset solve with supervised way | |
# using LinearRegression | |
# 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] | |
from sklearn.model_selection import train_test_split | |
from sklearn.linear_model import LinearRegression | |
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 = LinearRegression() | |
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