mirror of
https://github.com/jung-geun/PSO.git
synced 2025-12-20 04:50:45 +09:00
23-07-11
mnist one hot 인코딩 적용후 손실 함수 mse 로 변경
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -11,6 +11,6 @@ result/
|
|||||||
# 논문 관련 파일
|
# 논문 관련 파일
|
||||||
*.pdf
|
*.pdf
|
||||||
*.pptx
|
*.pptx
|
||||||
*.png
|
|
||||||
관련 논문/
|
관련 논문/
|
||||||
발표 자료/
|
발표 자료/
|
||||||
BIN
history_plt/mnist_45.96.png
Normal file
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
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 |
BIN
history_plt/mnist_mse_43.38.png
Normal file
BIN
history_plt/mnist_mse_43.38.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 137 KiB |
6
mnist.py
6
mnist.py
@@ -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,
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|||||||
16
readme.md
16
readme.md
@@ -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%를 보이고 있습니다
|
||||||

|

|
||||||
|
|
||||||
### Trouble Shooting
|
### Trouble Shooting
|
||||||
|
|
||||||
|
|||||||
BIN
weights.h5
BIN
weights.h5
Binary file not shown.
Reference in New Issue
Block a user