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 bentoml | |
import tensorflow as tf | |
from tensorflow import keras | |
from bentoml.artifact import TensorflowSavedModelArtifact | |
from bentoml.adapters import JsonInput | |
REVIEW_CLASSES = ['negative', 'positive'] |
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
$ paste -d : file1 file2 | shuf | |
five:5 | |
two:2 | |
one:1 | |
four:4 | |
three:3 | |
$ paste -d ':' file1 file2 | shuf | awk -v FS=":" '{ print $1 > "out1" ; print $2 > "out2" }' |
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 tensorflow as tf | |
import numpy as np | |
def my_func(input_x): | |
result = [] | |
for idx in input_x: | |
if idx % 2 == 1: | |
result.append(3) | |
return np.array(result) | |
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 tensorflow as tf | |
X_1 = tf.placeholder(shape=None, dtype=tf.float32) | |
Y_1 = tf.placeholder(shape=None, dtype=tf.float32) | |
Y_2 = tf.placeholder(shape=None, dtype=tf.float32) | |
W1 = tf.get_variable("W1", [1,10]) | |
W2 = tf.get_variable("W2", [1,10]) | |
result = tf.multiply(X_1, W1) |
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
# -*- coding: utf-8 -*- | |
""" | |
Created on Fri Dec 6 18:13:34 2019 | |
@author: jbk48 | |
""" | |
import pandas as pd | |
import sentencepiece as spm |
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 pandas as pd | |
import matplotlib.pyplot as plt | |
import seaborn as sns | |
def bar_plot(col, data, hue=None): ## 정수형을 위한 | |
f, ax = plt.subplots(figsize=(10, 5)) | |
sns.countplot(x=col, hue=hue, data=data, alpha=0.5) | |
plt.show() |
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
library(MASS) | |
library(car) | |
install.packages("cars") | |
a = read.csv("남한산성_train.csv", sep=",") | |
train_data = a[, -1] | |
linear_model <- lm(eightdays_aud ~. , data = train_data) |
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 random | |
import numpy as np | |
class shuffle(): | |
def __init__(self): | |
np.random.seed(1234) | |
def shuffle_string(self, string): | |
chars = list(string) |
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 tensorflow as tf | |
import numpy as np | |
import sys | |
def _bytes_feature(value): | |
"""Returns a bytes_list from a string / byte.""" | |
return tf.train.Feature(bytes_list=tf.train.BytesList(value=[value])) | |
def _float_feature(value): | |
"""Returns a float_list from a float / double.""" |
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 tensorflow as tf | |
import numpy as np | |
features, labels = (np.random.sample((100,2)), np.random.randint(low=0, high=10 , size=(100,1))) | |
dataset = tf.data.Dataset.from_tensor_slices((features,labels)) | |
dataset = tf.data.Dataset.from_tensor_slices((features,labels)) | |
dataset = dataset.shuffle(len(features)) | |
dataset = dataset.batch(16) | |
dataset = dataset.repeat() |
NewerOlder