mnist one hot 인코딩 적용후 손실 함수 mse 로 변경
This commit is contained in:
jung-geun
2023-07-11 15:00:50 +09:00
parent 026223bd19
commit 2b010c4257
10 changed files with 21 additions and 21 deletions

2
.gitignore vendored
View File

@@ -11,6 +11,6 @@ result/
# 논문 관련 파일 # 논문 관련 파일
*.pdf *.pdf
*.pptx *.pptx
*.png
관련 논문/ 관련 논문/
발표 자료/ 발표 자료/

BIN
history_plt/mnist_45.96.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

BIN
history_plt/mnist_46.57.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 92 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 137 KiB

View File

@@ -84,12 +84,12 @@ if __name__ == "__main__":
try: try:
pso_mnist = Optimizer( pso_mnist = Optimizer(
model, model,
loss=loss[1], loss=loss[0],
n_particles=75, n_particles=75,
c0=0.25, c0=0.25,
c1=0.4, c1=0.4,
w_min=0.3, w_min=0.2,
w_max=0.7, w_max=0.55,
negative_swarm=0.1, negative_swarm=0.1,
mutation_swarm=0.2, mutation_swarm=0.2,
) )

View File

@@ -62,11 +62,11 @@ x_train, y_train, x_test, y_test = get_data()
y_train = tf.one_hot(y_train, 10) y_train = tf.one_hot(y_train, 10)
y_test = tf.one_hot(y_test, 10) y_test = tf.one_hot(y_test, 10)
model.compile( # model.compile(
optimizer="adam", loss="categorical_crossentropy", metrics=["accuracy"] # optimizer="adam", loss="categorical_crossentropy", metrics=["accuracy"]
) # )
# model.compile(optimizer="adam", loss="mse", metrics=["accuracy"]) model.compile(optimizer="adam", loss="mse", metrics=["accuracy"])
print("Training model...") print("Training model...")
model.fit(x_train, y_train, epochs=100, batch_size=128, verbose=1) model.fit(x_train, y_train, epochs=100, batch_size=128, verbose=1)

File diff suppressed because one or more lines are too long

View File

@@ -148,17 +148,17 @@ best_score = pso_iris.fit(
3. mnist 문제 3. mnist 문제
```python ```python
loss = 'sparse_categorical_crossentropy' loss = 'mse'
pso_mnist = Optimizer( pso_mnist = Optimizer(
model, model,
loss=loss, loss=loss,
n_particles=75, n_particles=75,
c0=0.35, c0=0.25,
c1=0.7, c1=0.4,
w_min=0.45, w_min=0.2,
w_max=0.9, w_max=0.6,
negative_swarm=0.2, negative_swarm=0.1,
mutation_swarm=0.2, mutation_swarm=0.2,
) )
@@ -175,8 +175,8 @@ best_score = pso_mnist.fit(
) )
``` ```
위의 파라미터 기준 현재 정확도 46%를 보이고 있습니다 위의 파라미터 기준 현재 정확도 43.38%를 보이고 있습니다
![mnist](./history_plt/mnist_46.57.png) ![mnist](./history_plt/mnist_mse_43.38.png)
### Trouble Shooting ### Trouble Shooting

Binary file not shown.