fix
This commit is contained in:
parent
d91cded186
commit
e5031481ce
11
model.py
11
model.py
@ -8,7 +8,9 @@ from tensorflow.keras.models import Sequential
|
|||||||
from tensorflow.keras.layers import Dense
|
from tensorflow.keras.layers import Dense
|
||||||
import tensorflow as tf
|
import tensorflow as tf
|
||||||
|
|
||||||
data = pd.read_csv('./data/train.csv')
|
# data = pd.read_csv('./data/train.csv')
|
||||||
|
data = pd.read_csv('./openpowerlifting.csv')
|
||||||
|
print(data)
|
||||||
|
|
||||||
data = data[['Sex', 'Age', 'BodyweightKg', 'TotalKg']].dropna()
|
data = data[['Sex', 'Age', 'BodyweightKg', 'TotalKg']].dropna()
|
||||||
|
|
||||||
@ -21,7 +23,7 @@ preprocessor = ColumnTransformer(
|
|||||||
transformers=[
|
transformers=[
|
||||||
('num', StandardScaler(), ['Age', 'BodyweightKg']),
|
('num', StandardScaler(), ['Age', 'BodyweightKg']),
|
||||||
('cat', OneHotEncoder(), ['Sex'])
|
('cat', OneHotEncoder(), ['Sex'])
|
||||||
]
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
pipeline = Pipeline(steps=[
|
pipeline = Pipeline(steps=[
|
||||||
@ -35,8 +37,9 @@ pipeline = Pipeline(steps=[
|
|||||||
|
|
||||||
pipeline['model'].compile(optimizer='adam', loss='mse', metrics=['mae'])
|
pipeline['model'].compile(optimizer='adam', loss='mse', metrics=['mae'])
|
||||||
|
|
||||||
X_train_excluded = X_train.iloc[:, 1:]
|
X_train_excluded = X_train.iloc[1:]
|
||||||
|
y_train_excluded = y_train.iloc[1:]
|
||||||
|
|
||||||
pipeline.fit(X_train_excluded, y_train, model__epochs=10, model__validation_split=0.1)
|
pipeline.fit(X_train_excluded, y_train_excluded, model__epochs=int(sys.argv[1]), model__validation_split=0.1)
|
||||||
|
|
||||||
pipeline['model'].save('powerlifting_model.h5')
|
pipeline['model'].save('powerlifting_model.h5')
|
||||||
|
Loading…
Reference in New Issue
Block a user