Skip to content

Instantly share code, notes, and snippets.

View x2ever's full-sized avatar
๐ŸŽฏ
Focusing

ํ•œ์ผ์„ x2ever

๐ŸŽฏ
Focusing
  • SKKU, ์„ฑ๊ท ๊ด€๋Œ€ํ•™๊ต
  • Seoul, Republic of Korea
View GitHub Profile
import tensorflow as tf
import numpy as np
# XOR
X = np.array([[0, 0], [0, 1], [1, 0], [1, 1]])
Y = np.array([0, 1, 1, 0])
model = tf.keras.Sequential([
tf.keras.layers.Dense(8, activation=tf.nn.sigmoid),
tf.keras.layers.Dense(1, activation=None)
import tensorflow as tf
import numpy as np
# And
X = np.array([[0, 0], [0, 1], [1, 0], [1, 1]])
Y = np.array([0, 0, 0, 1])
model = tf.keras.Sequential([
tf.keras.layers.Dense(1, activation=None)
])
X = [2, 3, 4]
Y = [50, 60, 70]
a = 20
b = 10
# H = a * X + b
for i in range(200): # 100๋ฒˆ ํ•™์Šต ๊ณผ์ •์„ ์ง„ํ–‰ํ•œ๋‹ค.
import gym
import numpy as np
import warnings
import cv2
from gym import error, spaces, utils
from gym.utils import seeding
class SnakeGameEnv(gym.Env):
metadata = {'render.modes': ['human', 'rgb_array']}
@x2ever
x2ever / particle_simulation.py
Created October 15, 2019 01:12
Particle Simulation for checking Boltzmann-Distribution
import matplotlib.pyplot as plt
import matplotlib.animation as animation
import numpy as np
import pandas as pd
class ANI_Scatter(object):
"""An animated scatter plot using matplotlib.animations.FuncAnimation."""
def __init__(self, numpoints, area, e):
# ๊ฐœ์ฒด ์ˆ˜, ์šด๋™ ์˜์—ญ
def solution(arrangement):
answer = 0
depth = 0
def isLaser(index):
if (arrangement[index] == '(' and arrangement[index + 1] == ')')\
or (arrangement[index] == ')' and arrangement[index - 1] == '('):
return True
else:
return False
@x2ever
x2ever / XNOR.py
Last active May 6, 2019 07:10
Training XNOR with Deep learning. This code used only the numpy module.
import numpy as np
# Setting for learning Neural Network
N = 4 # N = number of training data
Max = 10000 +1 # number of epochs to repeat
learning_rate = 1 # learning rate
# Define some functions
def sigmoid(x):
@x2ever
x2ever / MadicalDataRecordSystem.sol
Created April 27, 2019 10:33
์˜๋ฃŒ๊ธฐ๋ก ํ•ด์‰ฌ ์ €์žฅ ๋ชจ๋ธ
pragma solidity >=0.4.22 <0.6.0;
// pragma experimental ABIEncoderV2;
contract MadicalDataRecordSystem {
struct MadicalRecord {
uint patient_id; // ๋ˆ„๊ฐ€
uint timestamp; // ์–ธ์ œ
uint hospital_id; // ์–ด๋””์„œ
uint record_type; // ์–ด๋–ป๊ฒŒ ( 0: ์ž˜๋ชป๋œ ํ—ค๋”, 1: ์ง„๋ฃŒ, 2: ์ˆ˜์ˆ , 3: ์ฒ˜๋ฐฉ )
@x2ever
x2ever / Cost_Model.sol
Created January 24, 2019 12:07
Cost Model which is mentioned at Book, Radical Market
pragma solidity ^0.5.0;
pragma experimental ABIEncoderV2;
contract CostModel {
address owner;
uint globalIndex;
struct Item {
address owner;
@x2ever
x2ever / Ballot_0.5.2.sol
Last active April 21, 2019 13:34
Change 0.4.22 version Ballot example into 0.5.2 version
pragma solidity ^0.5.2;
contract Ballot {
struct Voter {
uint weight;
bool voted;
address delegate;
uint vote;
}