import Model.Classification.Input.get_input as input from sklearn.metrics import classification_report, confusion_matrix from sklearn.linear_model import SGDClassifier # dir = "/Users/chienvn/PycharmProjects/Weather/Files/weather_exclude.csv" dir = "/Users/chienvn/PycharmProjects/Weather/Files/weather_include.csv" dir = "/Users/chienvn/PycharmProjects/Weather/Model/Classification/Input/new_weather_Ex.csv" train, test, train_lb, test_lb = input.get_input_new(dir) SGD_classification = SGDClassifier(shuffle=True, loss='log') # SGD_classification = SGDClassifier(loss='hinge') # SGD_classification = SGDClassifier(shuffle=True, loss='modified_huber') # SGD_classification = SGDClassifier(loss='squared_hinge', random_state=42) SGD_classification.fit(train, train_lb) prediction = SGD_classification.predict(test) print(confusion_matrix(test_lb, prediction)) print(classification_report(test_lb, prediction)) dir_test = "/Users/chienvn/PycharmProjects/Weather/Model/Classification/Input/new_weather_Test.csv" new_test, new_test_lb = input.get_input_test(dir_test) new_prediction = SGD_classification.predict(new_test) print(confusion_matrix(new_test_lb, new_prediction)) print(classification_report(new_test_lb, new_prediction))
from sklearn.preprocessing import LabelEncoder, MinMaxScaler from sklearn.metrics import mean_squared_error, mean_absolute_error from keras.models import Sequential from keras.layers import Dense, Dropout, LSTM, Flatten import numpy as np import pandas as pds import matplotlib.pyplot as plt import Model.Classification.Input.get_input as input dir_test = "/Users/chienvn/PycharmProjects/Weather/Model/Classification/Input/new_weather_Test.csv" dir_train = "/Users/chienvn/PycharmProjects/Weather/Model/Classification/Input/new_weather_Ex.csv" train, train_lb = input.get_input_test(dir_train) test, test_lb = input.get_input_test(dir_test) encoder = LabelEncoder() model = Sequential() model.add(Dense(20, input_dim=60, activation='relu')) model.add(Dense(20, activation='relu')) model.add(Dense(1, activation='sigmoid')) model.compile(loss='binary_crossentropy', optimizer='adam', metrics=['accuracy'])