This file contains hidden or 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
| prediction = model.predict_classes(X_test) | |
| prediction = prediction.reshape(5370,) | |
| data = {'True':y_test,'Predicted':prediction} | |
| df2 = pd.DataFrame(data) | |
| from sklearn.metrics import classification_report,confusion_matrix | |
| print(classification_report(df2['True'],df2['Predicted'])) | |
| print(confusion_matrix(df2['True'],df2['Predicted'])) |
This file contains hidden or 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
| from tensorflow.keras.models import Sequential | |
| from tensorflow.keras.layers import Dense,Dropout | |
| from tensorflow.keras.callbacks import EarlyStopping | |
| model = Sequential() | |
| model.add(Dense(10,input_dim=8,activation='relu')) | |
| model.add(Dropout(0.5)) | |
| model.add(Dense(15,activation='relu')) | |
| model.add(Dropout(0.5)) |
This file contains hidden or 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
| from sklearn.model_selection import train_test_split | |
| X = df.drop('target_class',axis=1) | |
| y = df['target_class'] | |
| X_train,X_test,y_train,y_test = train_test_split(X,y,test_size=0.3) | |
| from sklearn.preprocessing import MinMaxScaler | |
| scaler = MinMaxScaler() | |
| scaler.fit(X_train) |
This file contains hidden or 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
| import pandas as pd | |
| import numpy as np | |
| import seaborn as sns | |
| import matplotlib.pyplot as plt | |
| df = pd.read_csv('pulsar_stars.csv') | |
| df.info() |
This file contains hidden or 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
| import pandas as pd | |
| import numpy as np | |
| import matplotlib.pyplot as plt | |
| import seaborn as sns | |
| plt.show() | |
| df = sns.load_dataset('iris') | |
| #use machine learning for classification. Via logistic regression and KNN | |
| #1) logistic regression |