test poly keras
This commit is contained in:
parent
e865273ec1
commit
6f3eeb63c4
44
run2.py
44
run2.py
@ -21,29 +21,27 @@ from sklearn.preprocessing import PolynomialFeatures
|
||||
|
||||
poly = PolynomialFeatures(2, interaction_only=True)
|
||||
df = poly.fit_transform(x)
|
||||
pol_reg = LinearRegression()
|
||||
pol_reg.fit(df, y)
|
||||
|
||||
# model = Sequential(
|
||||
# [
|
||||
# Dense(512, activation="relu", input_dim=73, kernel_regularizer="l2"),
|
||||
# tensorflow.keras.layers.BatchNormalization(),
|
||||
# Dense(512 // 2, activation="relu", kernel_regularizer="l2"),
|
||||
# tensorflow.keras.layers.BatchNormalization(),
|
||||
# Dense(512 // 4, activation="relu", kernel_regularizer="l2"),
|
||||
# tensorflow.keras.layers.BatchNormalization(),
|
||||
# Dense(512 // 8, activation="relu", kernel_regularizer="l2"),
|
||||
# tensorflow.keras.layers.BatchNormalization(),
|
||||
# Dense(32, activation="relu", kernel_regularizer="l2"),
|
||||
# tensorflow.keras.layers.BatchNormalization(),
|
||||
# Dense(1),
|
||||
# ]
|
||||
# )
|
||||
#
|
||||
# model.compile(
|
||||
# loss="mean_squared_error", optimizer="adam", metrics=["mean_squared_error"]
|
||||
# )
|
||||
# model.fit(x, y, epochs=100)
|
||||
model = Sequential(
|
||||
[
|
||||
Dense(512, activation="relu", input_dim=2702, kernel_regularizer="l2"),
|
||||
tensorflow.keras.layers.BatchNormalization(),
|
||||
Dense(512 // 2, activation="relu", kernel_regularizer="l2"),
|
||||
tensorflow.keras.layers.BatchNormalization(),
|
||||
Dense(512 // 4, activation="relu", kernel_regularizer="l2"),
|
||||
tensorflow.keras.layers.BatchNormalization(),
|
||||
Dense(512 // 8, activation="relu", kernel_regularizer="l2"),
|
||||
tensorflow.keras.layers.BatchNormalization(),
|
||||
Dense(32, activation="relu", kernel_regularizer="l2"),
|
||||
tensorflow.keras.layers.BatchNormalization(),
|
||||
Dense(1),
|
||||
]
|
||||
)
|
||||
|
||||
model.compile(
|
||||
loss="mean_squared_error", optimizer="adam", metrics=["mean_squared_error"]
|
||||
)
|
||||
model.fit(df, y, epochs=100)
|
||||
|
||||
x_test = pd.read_csv("test-A/in.tsv", sep="\t", names=in_columns)
|
||||
df_train = pd.read_csv("train/in.tsv", names=in_columns, sep="\t")
|
||||
@ -55,7 +53,7 @@ x_test = pd.get_dummies(x_test, columns=["id_stacji", "rok", "miesiąc"])
|
||||
x_test = x_test.iloc[:-8760]
|
||||
poly = PolynomialFeatures(2, interaction_only=True)
|
||||
x_test2 = poly.fit_transform(x_test)
|
||||
pred = pol_reg.predict(x_test2)
|
||||
pred = model.predict(x_test2)
|
||||
|
||||
out = pd.DataFrame(pred)
|
||||
out.to_csv("test-A/out.tsv", sep="\t", header=False, index=False)
|
||||
|
1440
test-A/out.tsv
1440
test-A/out.tsv
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user