-
Notifications
You must be signed in to change notification settings - Fork 1
/
buildmodel.py
41 lines (41 loc) · 1.15 KB
/
buildmodel.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# import numpy as np
# import pandas as pd
# from sklearn.preprocessing import MinMaxScaler
# from sklearn.model_selection import train_test_split
# import tensorflow as tf
# from tensorflow import keras
# from tensorflow.keras.layers import Dense,Dropout
#
# df=pd.read_csv(r'dataset.cvs')
# cols=list(df.columns)
#
# x=df.drop(["diameter"],axis=1)
# y=np.array(df["diameter"]).reshape((-1,1))
# scaler1=MinMaxScaler()
# scaler2=MinMaxScaler()
# x=scaler1.fit_transform(x)
# y=scaler2.fit_transform(y)
#
# xtrain,xtest,ytrain,ytest=train_test_split(x,y,random_state=42,train_size=0.8)
#
# from pickle import dump
#
# dump(scaler1, open('scaler1.pkl', 'wb'))
# dump(scaler2, open('scaler2.pkl', 'wb'))
#
# model=keras.Sequential([
# Dense(128,activation="relu"),
# Dropout(0.3),
# Dense(64,activation="relu"),
# Dropout(0.2),
# Dense(32,activation="relu"),
# Dense(1,activation="linear")
# ])
# model.compile(optimizer=keras.optimizers.Adam(),loss=keras.losses.mean_squared_error,metrics=[keras.metrics.RootMeanSquaredError()])
#
# model.fit(xtrain,ytrain,epochs=20,validation_split=0.1)
#
# print(model.evaluate(xtest,ytest))
#
# model.save("model1.h5")
#