
# logistic regression
from pandas import read_csv
from sklearn.metrics import accuracy_score
from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_score,f1_score
from sklearn.linear_model import LogisticRegression
from sklearn.ensemble import RandomForestClassifier
# load the dataset
data = read_csv('SpaData.csv', header=0, index_col=0, parse_dates=True, squeeze=True)
data = data.drop("TimeStamp",axis = 1)
print (data['GTOccupancy'].value_counts())
values = data.values

# split data into inputs and outputs
X, y = values[:, :-1], values[:, -1]
# split the dataset
trainX, testX, trainy, testy = train_test_split(X, y, test_size=0.3, shuffle=False, random_state=1)
# define the model
model = RandomForestClassifier()
# fit the model on the training set
model.fit(trainX, trainy)
# predict the test set
yhat = model.predict(testX)
# evaluate model skill
score = accuracy_score(testy, yhat)
print(score)
print (f1_score(testy, yhat))
aad3ea4a387a405825a492819b7c2c1cef00f133
<mask token>

<mask token>
print(data['GTOccupancy'].value_counts())
<mask token>
model.fit(trainX, trainy)
<mask token>
print(score)
print(f1_score(testy, yhat))

<mask token>
data = read_csv('SpaData.csv', header=0, index_col=0, parse_dates=True,
    squeeze=True)
data = data.drop('TimeStamp', axis=1)
print(data['GTOccupancy'].value_counts())
values = data.values
X, y = values[:, :-1], values[:, -1]
trainX, testX, trainy, testy = train_test_split(X, y, test_size=0.3,
    shuffle=False, random_state=1)
model = RandomForestClassifier()
model.fit(trainX, trainy)
yhat = model.predict(testX)
score = accuracy_score(testy, yhat)
print(score)
print(f1_score(testy, yhat))

from pandas import read_csv
from sklearn.metrics import accuracy_score
from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_score, f1_score
from sklearn.linear_model import LogisticRegression
from sklearn.ensemble import RandomForestClassifier
data = read_csv('SpaData.csv', header=0, index_col=0, parse_dates=True,
    squeeze=True)
data = data.drop('TimeStamp', axis=1)
print(data['GTOccupancy'].value_counts())
values = data.values
X, y = values[:, :-1], values[:, -1]
trainX, testX, trainy, testy = train_test_split(X, y, test_size=0.3,
    shuffle=False, random_state=1)
model = RandomForestClassifier()
model.fit(trainX, trainy)
yhat = model.predict(testX)
score = accuracy_score(testy, yhat)
print(score)
print(f1_score(testy, yhat))


# logistic regression
from pandas import read_csv
from sklearn.metrics import accuracy_score
from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_score,f1_score
from sklearn.linear_model import LogisticRegression
from sklearn.ensemble import RandomForestClassifier
# load the dataset
data = read_csv('SpaData.csv', header=0, index_col=0, parse_dates=True, squeeze=True)
data = data.drop("TimeStamp",axis = 1)
print (data['GTOccupancy'].value_counts())
values = data.values

# split data into inputs and outputs
X, y = values[:, :-1], values[:, -1]
# split the dataset
trainX, testX, trainy, testy = train_test_split(X, y, test_size=0.3, shuffle=False, random_state=1)
# define the model
model = RandomForestClassifier()
# fit the model on the training set
model.fit(trainX, trainy)
# predict the test set
yhat = model.predict(testX)
# evaluate model skill
score = accuracy_score(testy, yhat)
print(score)
print (f1_score(testy, yhat))