View tf_iris_classification.py
''' | |
Tensorflow 심층신경망(DNN)을 이용하여 꽃 분류하기 (Classification) | |
순서: | |
1. CSV로 부터 Iris 훈련/시험 데이터를 읽는다. | |
2. 분류하는 신경망을 만든다. | |
3. 데이터를 통한 훈련. | |
4. 새로운 샘플을 통해 판별하기. | |
SL SW PL PW species |
View tf_estimator_custom.py
import numpy as np | |
import tensorflow as tf | |
# 커스텀 Estimator 모델(func) | |
def model_fn(features, labels, mode): | |
W = tf.get_variable('W', [1], dtype=tf.float64) # tf.get_variable(): Gets an existing variable with parameter or create a new one. | |
b = tf.get_variable('b', [1], dtype=tf.float64) | |
y = W * features['x'] + b | |
# loss(오차) 서브 그래프 |
View tf_estimator_linear_regressor.py
import numpy as np | |
import tensorflow as tf | |
x = tf.feature_column.numeric_column('x', shape=[1]) # 랭크 1 텐서, 1차원 배열 | |
feature_columns = [x] | |
# LinearRegressor < tf.estimator.Estimator | |
estimator = tf.estimator.LinearRegressor(feature_columns=feature_columns) | |
# 데이터 세트 |
View tf_ex1.py
import random | |
import tensorflow as tf | |
# tf.constant | |
sess = tf.Session() | |
node1 = tf.constant(3.0, dtype=tf.float32) # 상수 노드 | |
node2 = tf.constant(4.0) | |
node3 = tf.add(node1, node2) # 합 노드 |
View peewee_orm_ex1.py
import sys | |
import peewee as pw # http://peewee.readthedocs.io/en/latest/peewee/api.html | |
# CONNECT | |
try: | |
db = pw.MySQLDatabase("database_name", host="192.168.0.10", port=3306, user="oiehot", passwd="1234") | |
db.connect() | |
except: | |
print('DB 접속 실패') | |
sys.exit() |
View clien_board_watcher.py
import json | |
import threading | |
import datetime | |
import re | |
import sqlite3 | |
import requests | |
import log | |
from urllib.parse import urljoin, urlparse | |
from bs4 import BeautifulSoup | |
from telegram.bot import Bot |
View telegram_bot.py
import threading | |
import telepot | |
import sqlite3 | |
import log | |
SETTINGS_TABLE = 'settings' | |
SUBSCRIBER_TABLE = 'subscriber' | |
LAST_UPDATE_ID = 'last_update_id' | |
UPDATE_INTERVAL_SEC = 5 |
View ps_packer.jsx
SPRITE_MARGIN = 2 | |
function rect_str(r) { | |
return "x: " + r.x + ", y: " + r.y + ", w: " + r.w + ", h: " + r.h | |
} | |
function rects_str(rects) { | |
str = "" | |
for(var i=0; i<rects.length; i++) { | |
str += "["+i+"]" + rect_str(rects[i]) + "\n" |
View paste_in_place.py
import comtypes.client | |
app = comtypes.client.CreateObject('Photoshop.Application.60') # CS6 | |
def paste_in_place(): | |
# var idpast = charIDToTypeID( "past" ); | |
idpast = app.CharIDToTypeID('past') | |
# var desc862 = new ActionDescriptor(); | |
desc862 = comtypes.client.CreateObject('Photoshop.ActionDescriptor.60') | |
# var idinPlace = stringIDToTypeID( "inPlace" ); | |
idinPlace = app.StringIDToTypeID('inPlace') |
NewerOlder