mirror of
https://github.com/jung-geun/PSO.git
synced 2025-12-20 04:50:45 +09:00
23-10-21
loss + mse 로 조기 수렴 시 초기화 적용 파티클의 초기화를 opeimizer 에서 particle 객체로 변경 메모리의 점진적인 누수 #6 현재 누수가 다시 조금씩 증가하는것이 보임
This commit is contained in:
@@ -36,16 +36,16 @@ def get_data():
|
||||
def make_model():
|
||||
model = Sequential()
|
||||
model.add(
|
||||
Conv2D(32, kernel_size=(5, 5), activation="sigmoid",
|
||||
Conv2D(32, kernel_size=(5, 5), activation="relu",
|
||||
input_shape=(28, 28, 1))
|
||||
)
|
||||
model.add(MaxPooling2D(pool_size=(2, 2)))
|
||||
model.add(Conv2D(64, kernel_size=(3, 3), activation="sigmoid"))
|
||||
model.add(Conv2D(64, kernel_size=(3, 3), activation="relu"))
|
||||
model.add(MaxPooling2D(pool_size=(2, 2)))
|
||||
model.add(Flatten())
|
||||
model.add(Dropout(0.25))
|
||||
model.add(Dense(256, activation="sigmoid"))
|
||||
model.add(Dense(128, activation="sigmoid"))
|
||||
model.add(Dense(256, activation="relu"))
|
||||
model.add(Dense(128, activation="relu"))
|
||||
model.add(Dense(10, activation="softmax"))
|
||||
|
||||
return model
|
||||
@@ -90,18 +90,16 @@ loss = [
|
||||
|
||||
pso_mnist = optimizer(
|
||||
model,
|
||||
loss="mean_squared_error",
|
||||
loss="categorical_crossentropy",
|
||||
n_particles=500,
|
||||
c0=0.2,
|
||||
c1=0.4,
|
||||
w_min=0.3,
|
||||
w_max=0.5,
|
||||
c0=0.5,
|
||||
c1=1.0,
|
||||
w_min=0.7,
|
||||
w_max=1.2,
|
||||
negative_swarm=0.05,
|
||||
mutation_swarm=0.3,
|
||||
particle_min=-0.3,
|
||||
particle_max=0.3,
|
||||
early_stopping=True,
|
||||
early_stopping_patience=10,
|
||||
convergence_reset=True,
|
||||
convergence_reset_patience=10,
|
||||
)
|
||||
|
||||
best_score = pso_mnist.fit(
|
||||
@@ -112,11 +110,11 @@ best_score = pso_mnist.fit(
|
||||
log=2,
|
||||
log_name="fashion_mnist",
|
||||
save_path="./logs/fashion_mnist",
|
||||
renewal="acc",
|
||||
renewal="mse",
|
||||
check_point=25,
|
||||
empirical_balance=False,
|
||||
dispersion=False,
|
||||
batch_size=1024,
|
||||
batch_size=5000,
|
||||
)
|
||||
|
||||
print("Done!")
|
||||
|
||||
Reference in New Issue
Block a user