mirror of
https://github.com/jung-geun/PSO.git
synced 2025-12-19 20:44:39 +09:00
23-05-31
전체 파티클 중 일부를 현재 속도의 음수 방향으로 진행하도록 하여 지역해에 갇혀 조기수렴하는 문제의 방안으로 사용
This commit is contained in:
12
mnist.py
12
mnist.py
@@ -23,9 +23,9 @@ from tqdm import tqdm
|
||||
|
||||
import gc
|
||||
|
||||
print(tf.__version__)
|
||||
print(tf.config.list_physical_devices())
|
||||
print(f"Num GPUs Available: {len(tf.config.list_physical_devices('GPU'))}")
|
||||
# print(tf.__version__)
|
||||
# print(tf.config.list_physical_devices())
|
||||
# print(f"Num GPUs Available: {len(tf.config.list_physical_devices('GPU'))}")
|
||||
|
||||
|
||||
def get_data():
|
||||
@@ -79,10 +79,10 @@ loss = 'huber_loss'
|
||||
# loss = 'mean_squared_error'
|
||||
|
||||
|
||||
pso_mnist = Optimizer(model, loss=loss, n_particles=50, c0=0.5, c1=0.8, w_min=0.75, w_max=1.3)
|
||||
pso_mnist = Optimizer(model, loss=loss, n_particles=50, c0=0.4, c1=0.8, w_min=0.7, w_max=1.2, random=0.3)
|
||||
weight, score = pso_mnist.fit(
|
||||
x_test, y_test, epochs=1000, save=True, save_path="./result/mnist", renewal="acc", empirical_balance=False, Dispersion=True)
|
||||
x_test, y_test, epochs=200, save=True, save_path="./result/mnist", renewal="acc", empirical_balance=False, Dispersion=False, check_point=10)
|
||||
pso_mnist.model_save("./result/mnist")
|
||||
pso_mnist.save_info("./result/mnist")
|
||||
|
||||
gc.collect()
|
||||
gc.collect()
|
||||
Reference in New Issue
Block a user