This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib.pyplot as plt | |
import numpy as np | |
def transform(x): | |
return x + np.random.normal(size=len(x)) * 0.1 | |
t = np.linspace(0, 30, 300) # Time dimension | |
x1 = np.sin(t) # X vector values | |
y1 = np.cos(t) # Y vector values |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import matplotlib.pyplot as plt | |
np.random.seed(20) | |
### Set linear regression problem | |
a_true = 1 | |
b_true = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import matplotlib.pyplot as plt | |
np.random.seed(17) | |
def loss(x, y): | |
### Default loss. Can modify to others | |
return x ** 2 + y ** 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from math import e, sqrt, log, pi | |
import random | |
from collections import defaultdict | |
import math | |
import matplotlib.pyplot as plt | |
def f1(q): | |
value = (1 + math.erf(q * 0.005)) / 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct custom_hash { | |
static uint64_t splitmix64(uint64_t x) { | |
// http://xorshift.di.unimi.it/splitmix64.c | |
x += 0x9e3779b97f4a7c15; | |
x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9; | |
x = (x ^ (x >> 27)) * 0x94d049bb133111eb; | |
return x ^ (x >> 31); | |
} | |
size_t operator()(uint64_t x) const { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct Fenw { | |
int n; | |
vector<ll> bit; | |
Fenw(int n): n(n) { | |
bit.assign(n + 1, 0); | |
} | |
void upd(int i, ll v) { | |
for(; i <= n; i += i & (-i)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PART 4. | |
We did the testing using JaCoCo. We build the project and then generate JaCoCo report. | |
Using the following commands. | |
./gradlew build | |
./gradlew jacocoTestReport | |
We have 72 tests testing 9 different classes. All test methods are in diet-bot\src\test\java\com\example\bot\spring folder. | |
Our test coverage report folder is attached in the following link: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
A3C, tensorflow, 42x42 input, 1 day | |
https://github.com/404akhan/custom-RL/tree/master/a3c |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import gym | |
from gym.wrappers import Monitor | |
import itertools | |
import numpy as np | |
import os | |
import random | |
import sys | |
import tensorflow as tf | |
from collections import deque, namedtuple |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import torch.nn as nn | |
import torch.nn.functional as F | |
def deconv(c_in, c_out, k_size, stride=2, pad=1, bn=True): | |
"""Custom deconvolutional layer for simplicity.""" | |
layers = [] | |
layers.append(nn.ConvTranspose2d(c_in, c_out, k_size, stride, pad)) | |
if bn: | |
layers.append(nn.BatchNorm2d(c_out, affine=False)) |
NewerOlder