This commit is contained in:
nlitkowski 2021-05-26 02:33:40 +02:00
parent d0d7934292
commit 53fd98388c
2 changed files with 298 additions and 290 deletions

View File

@ -780,7 +780,7 @@
0
0
0
1
0
0
0
0
@ -1957,7 +1957,6 @@
0
0
0
1
0
0
0
@ -2073,7 +2072,6 @@
0
0
0
1
0
0
0
@ -2108,288 +2106,6 @@
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
@ -2665,7 +2381,291 @@
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
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
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
2109 0
2110 0
2111 0
2381 0
2382 0
2383 0
2384 1 0
2385 0
2386 0
2387 0
2388 0
2389 0
2390 0
2391 0
2392 0
2393 0
2394 0
2395 0
2396 0
2397 0
2398 0
2399 0
2400 0
2401 0
2402 0
2403 0
2404 0
2405 0
2406 0
2407 0
2408 0
2409 0
2410 0
2411 0
2412 0
2413 0
2414 0
2415 0
2416 0
2417 0
2418 0
2419 0
2420 0
2421 0
2422 0
2423 0
2424 0
2425 0
2426 0
2427 0
2428 0
2429 0
2430 0
2431 0
2432 0
2433 0
2434 0
2435 0
2436 0
2437 0
2438 0
2439 0
2440 0
2441 0
2442 0
2443 0
2444 0
2445 0
2446 0
2447 0
2448 0
2449 0
2450 0
2451 0
2452 0
2453 0
2454 0
2455 0
2456 0
2457 0
2458 0
2459 0
2460 0
2461 0
2462 0
2463 0
2464 0
2465 0
2466 0
2467 0
2468 0
2469 0
2470 0
2471 0
2472 0
2473 0
2474 0
2475 0
2476 0
2477 0
2478 0
2479 0
2480 0
2481 0
2482 0
2483 0
2484 0
2485 0
2486 0
2487 0
2488 0
2489 0
2490 0
2491 0
2492 0
2493 0
2494 0
2495 0
2496 0
2497 0
2498 0
2499 0
2500 0
2501 0
2502 0
2503 0
2504 0
2505 0
2506 0
2507 0
2508 0
2509 0
2510 0
2511 0
2512 0
2513 0
2514 0
2515 0
2516 0
2517 0
2518 0
2519 0
2520 0
2521 0
2522 0
2523 0
2524 0
2525 0
2526 0
2527 0
2528 0
2529 0
2530 0
2531 0
2532 0
2533 0
2534 0
2535 0
2536 0
2537 0
2538 0
2539 0
2540 0
2541 0
2542 0
2543 0
2544 0
2545 0
2546 0
2547 0
2548 0
2549 0
2550 0
2551 0
2552 0
2553 0
2554 0
2555 0
2556 0
2557 0
2558 0
2559 0
2560 0
2561 0
2562 0
2563 0
2564 0
2565 0
2566 0
2567 0
2568 0
2569 0
2570 0
2571 0
2572 0
2573 0
2574 0
2575 0
2576 0
2577 0
2578 0
2579 0
2580 0
2581 0
2582 0
2583 0
2584 0
2585 0
2586 0
2587 0
2588 0
2589 0
2590 0
2591 0
2592 0
2593 0
2594 0
2595 0
2596 0
2597 0
2598 0
2599 0
2600 0
2601 0
2602 0
2603 0
2604 0
2605 0
2606 0
2607 0
2608 0
2609 0
2610 0
2611 0
2612 0
2613 0
2614 0
2615 0
2616 0
2617 0
2618 0
2619 0
2620 0
2621 0
2622 0
2623 0
2624 0
2625 0
2626 0
2627 0
2628 0
2629 0
2630 0
2631 0
2632 0
2633 0
2634 0
2635 0
2636 0
2637 0
2638 0
2639 0
2640 0
2641 0
2642 0
2643 0
2644 0
2645 0
2646 0
2647 0
2648 0
2649 0
2650 0
2651 0
2652 0
2653 0
2654 0
2655 0
2656 0
2657 0
2658 0
2659 0
2660 0
2661 0
2662 0
2663 0
2664 0
2665 0
2666 0
2667 0
2668 0
2669 0
2670 0
2671 0
3519 0
3520 0
3521 0
3522 1 0
3523 0
3524 0
3525 0
4265 0
4266 0
4267 0
4268 1 0
4269 0
4270 0
4271 0

View File

@ -16,7 +16,10 @@ class Model(nn.Module):
self.output_dim = output_dim
self.fc1 = nn.Linear(self.input_dim, self.hidden_dim)
self.fc2 = nn.Linear(self.hidden_dim, self.output_dim)
self.fc2 = nn.Linear(self.hidden_dim, self.hidden_dim)
self.fc3 = nn.Linear(self.hidden_dim, self.output_dim)
self.relu = nn.ReLU()
self.criterion = nn.BCELoss()
self.optimizer = torch.optim.SGD(self.parameters(), lr=0.01)
@ -25,14 +28,19 @@ class Model(nn.Module):
"""Step forward learning fn"""
x = self.fc1(x)
x = torch.relu(x)
x = self.relu(x)
x = self.fc2(x)
x = self.relu(x)
x = self.fc3(x)
x = torch.sigmoid(x)
return x
def run_training(self, X_train, Y_train, batch_size, epochs_count):
for _ in range(epochs_count):
self.train()
print(f"{Y_train.shape[0]}, {Y_train.shape[0] == self.input_dim}")
print(f"{Y_train.shape[0]}, {Y_train.shape[0] == self.hidden_dim}")
print(f"{Y_train.shape[0]}, {Y_train.shape[0] == self.output_dim}")
for i in range(0, Y_train.shape[0], batch_size):
X = X_train[i: i + batch_size]
X = torch.tensor(X)