Skip to content

Instantly share code, notes, and snippets.

@monisoi
monisoi / fizzbuzz_learning.py
Last active March 31, 2017 08:00
fizzbuzzをTensorFlowを使って解く
import numpy as np
import tensorflow as tf
def tensorflow_FizzBuzz():
NUM_DIGITS = 10
def binary_encode(i, num_digits):
return np.array([i >> d & 1 for d in range(num_digits)])
def fizz_buzz_encode(i):
@monisoi
monisoi / words_count.rb
Created December 11, 2016 05:41
JUMAN++を使って単語の重複カウントをする
require './jumanpp.rb'
# http://qiita.com/rtoya/items/33e5ac410704b70800b2 のruby用ラッパーコードを使用
# Open3.popen3('jumanpp') を Open3.popen3('jumanpp -M') に変更
require 'pp'
file_name = './sample.txt'
imported_words = []
File.open(file_name) do |file|
jumanpp = Jumanpp::Parser.new
@monisoi
monisoi / main.py
Last active September 2, 2017 13:14
if __name__ == '__main__':
from sklearn import datasets
from sklearn.model_selection import train_test_split
from random_forest import RandomForest
iris = datasets.load_iris()
X = iris.data
y = iris.target
X_train, X_test, y_train, y_test = train_test_split(
import numpy as np
from node import _Node
from sklearn.base import ClassifierMixin
class DecisionTree(ClassifierMixin):
def __init__(self):
self._root = None
def create_tree(self, X, y):
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
# coding: utf-8
import numpy as np
from im2col import im2col
class Convolution:
def __init__(self, W, b, stride=1, pad=0):
self.W = W
self.b = b
self.stride = stride
self.pad = pad
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import urllib.request
import sys
import os
import json
def download(import_file, number_of_files):
f = open(import_file, 'r')
json_data = json.load(f)
images = json_data["images"]
import urllib.request
import sys
import os
import json
def merge_by_image_id(import_file):
merged_images = []
f = open(import_file, 'r')
json_data = json.load(f)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.