Skip to content

Instantly share code, notes, and snippets.

Yunka Yunaka12

Block or report user

Report or block Yunaka12

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@Yunaka12
Yunaka12 / k_fold.py
Created Aug 30, 2019
各クラスの比率を保ったまま、学習データ、テストデータ、検証用データにk分割
View k_fold.py
import numpy as np
#配列をn分割
def split_data(data,split_num):
split_arr=[]
for i in range(0,len(data),split_num):
split_tmp_arr = data[i:i+split_num]
split_tmp_arr = np.array(split_tmp_arr).flatten()
split_arr.append(split_tmp_arr.tolist())
return split_arr
View variance.py
# coding: utf-8
# Your code here!
import numpy as np
data=np.array([[4.87,4.93,4.86,4.85],[4.86,4.90,4.85,4.86],[4.90,4.89,4.85,4.84],[4.87,4.91,4.81,4.86],[4.85,4.92,4.83,4.89]])
# data = np.array([[33,31,33],[30,29,31],[33,28,32],[29,29,32],[32,27,36]])
data_flatten = data.flatten()
data_mean = data_flatten.mean()
print("全体平均:{}".format(data_mean))
#列の平均
@Yunaka12
Yunaka12 / analysis_two_variable_function.py
Created May 12, 2019
2変数関数の極大・極小・鞍点をsympyを利用して求める
View analysis_two_variable_function.py
from sympy import Symbol, solve, Derivative, Matrix, simplify
x = Symbol('x')
y = Symbol('y')
f = 2*x**3 + 4*x*y**2 - 10*x*y + y**2
f_x = Derivative(f,x).doit() #xで1階偏微分
f_y = Derivative(f,y).doit() #yで1階偏微分
View drop.html
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<style>
body{
margin: 0 auto;
width: 980px;
}
a{
@Yunaka12
Yunaka12 / Twitter_all_media_downloader.py
Last active Aug 16, 2018
ツイッターの任意のユーザーの画像・動画・GIFをDLする。これらのメディア投稿時のツイートもエクセルファイルに保存する。
View Twitter_all_media_downloader.py
from twython import Twython, TwythonError
import urllib.request
import re
import time
import os
import emoji
import openpyxl
#ファイル名をツイート日時(日本時間)に設定
def change_name(date):
@Yunaka12
Yunaka12 / baba.py
Last active Jul 29, 2018
全自動ババ抜き。
View baba.py
import random
#カードを分配する関数
def dist(num):
player_tehuda = [[] for i in range(num)]
while len(cards) != 0:
for i in range(player_num):
if len(cards) != 0:
choice = random.choice(cards)
player_tehuda[i].append(choice)
@Yunaka12
Yunaka12 / cache.py
Last active Jul 29, 2018
jsonを利用した簡易的なキャッシュ。
View cache.py
from tinydb import TinyDB, Query
import datetime
#重い処理の例
def omoi(i):
#データベースから読み込まれていない場合
if i == 0:
for i in range(100000000):
i = i + 1
if DB_length == 0:
@Yunaka12
Yunaka12 / slater.py
Last active Jul 29, 2018
いくつかの原子の任意の有効核電荷をスレーターの規則に則って計算するプログラム。
View slater.py
densi = int(input("\n原子番号:"))
power = input("有効核電荷を求めたい電子の軌道:")
orbit_num = [2,2,6,2,6,2,10,6]
orbit_name = ["1s","2s","2p","3s","3p","4s","3d","4p"]
gensi = ["水素","ヘリウム","リチウム","ベリリウム","ホウ素","炭素","窒素","酸素","フッ素","ネオン","ナトリウム","マグネシウム","アルミニウム","ケイ素","リン","硫黄",
"塩素","アルゴン","カリウム","カルシウム","スカンジウム","チタン","バナジウム","クロム","マンガン","","コバルト","ニッケル","","亜鉛","ガリウム","ゲルマニウム",
"ヒ素","セレン","臭素","クリプトン"]
print("\n元素名: {}".format(gensi[densi-1]))
@Yunaka12
Yunaka12 / periodic_table.py
Last active Jul 29, 2018
いくつかの原子の原子軌道に電子を埋めていくだけのプログラム。
View periodic_table.py
densi = int(input("\n原子番号:"))
tmp = densi
gensi = ["水素","ヘリウム","リチウム","ベリリウム","ホウ素","炭素","窒素","酸素","フッ素","ネオン","ナトリウム","マグネシウム","アルミニウム","ケイ素","リン","硫黄",
"塩素","アルゴン","カリウム","カルシウム"]
orbit_num = [2,2,6,2,6,2,10]
orbit_name = ["1s","2s","2p","3s","3p","4s","3d"]
orbit=[]
@Yunaka12
Yunaka12 / RNA.py
Last active Jul 29, 2018
RNAを読み取って、合成されるタンパク質を求めるプログラム。
View RNA.py
RNA = input()
aminosan_list = {
"フェニルアラニン":["UUU","UUC"],
"ロイシン":["UUA","UUG","CUU","CUC","CUA","CUG"],
"イソロイシン":["AUU","AUC","AUA"],
"メチオニン":["AUG"],
"バリン":["GUU","GUC","GUA","GUG"],
"セリン":["UCU","UCC","UCA","UCG"],
"プロリン":["CCU","CCC","CCA","CCG"],
"トレオニン":["ACU","ACC","ACA","ACG"],
You can’t perform that action at this time.