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
from typing import TypeAlias | |
import pandas as pd | |
from predict_model import Estimator, LinearRegressionEstimator, MultiModel | |
from sklearn.datasets import load_diabetes | |
from sklearn.discriminant_analysis import StandardScaler | |
# MultiModelでの回帰モデルの実装例 | |
# 糖尿病の進行状況のデータセット読み込み |
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 math | |
from typing import Callable | |
def weighted_average(values: list[int|float], weights: list[int|float]=[], func: Callable[[int,int],int|float]|None=None) -> float: | |
if func: | |
weights = [func(i, len(values)) for i in range(len(values))] | |
if len(values)!=len(weights): | |
raise IndexError(f'values and weights have different lengths: values={len(values)} weights={len(weights)}') |
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
// https://github.com/zh-lx/pinyin-pro | |
// version 3.11.0 | |
var n = ["zh", "ch", "sh", "z", "c", "s", "b", "p", "m", "f", "d", "t", "n", "l", "g", "k", "h", "j", "q", "x", "r", "y", "w", ""], | |
h = { | |
"南宫": "nán gōng", | |
"第五": "dì wǔ", | |
"万俟": "mò qí", | |
"司马": "sī mǎ", | |
"上官": "shàng guān", |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
#!python | |
""" | |
requirements.txt | |
jieba==0.42.1 | |
googletrans==4.0.0rc1 | |
pandas==1.3.5 | |
pickleDB==0.9.2 | |
""" |
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 pandas as pd | |
RED_GREEN = ["フシギダネ","フシギソウ","フシギバナ","ヒトカゲ","リザード","リザードン","ゼニガメ","カメール","カメックス","キャタピー","トランセル","バタフリー","ビードル","コクーン","スピアー","ポッポ","ピジョン","ピジョット","コラッタ","ラッタ","オニスズメ","オニドリル","アーボ","アーボック","ピカチュウ","ライチュウ","サンド","サンドパン","ニドリーナ","ニドクイン","ニドリーノ","ニドキング","ピッピ","ピクシー","ロコン","キュウコン","プリン","プクリン","ズバット","ゴルバット","ナゾノクサ","クサイハナ","ラフレシア","パラス","パラセクト","コンパン","モルフォン","ディグダ","ダグトリオ","ニャース","ペルシアン","コダック","ゴルダック","マンキー","オコリザル","ガーディ","ウインディ","ニョロモ","ニョロゾ","ニョロボン","ケーシィ","ユンゲラー","フーディン","ワンリキー","ゴーリキー","カイリキー","マダツボミ","ウツドン","ウツボット","メノクラゲ","ドククラゲ","イシツブテ","ゴローン","ゴローニャ","ポニータ","ギャロップ","ヤドン","ヤドラン","コイル","レアコイル","カモネギ","ドードー","ドードリオ","パウワウ","ジュゴン","ベトベター","ベトベトン","シェルダー","パルシェン","ゴース","ゴースト","ゲンガー","イワーク","スリープ","スリーパー","クラブ","キングラー","ビリリダマ","マルマイン","タマタマ","ナッシー","カラカラ","ガラガラ","サワムラー","エビワラー","ベロリンガ","ドガース","マタドガス","サイホーン","サイドン","ラッキー","モンジャラ","ガルーラ","タッツー","シードラ","トサキント","アズマオウ","ヒトデマン","スターミー","バリヤード","ストライク","ルージュラ","エレブー","ブーバー","カイロス","ケンタロス","コイキング","ギャラドス","ラプラス","メタモン","イーブイ","シャワーズ","サンダース |
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
class Ingredient | |
attr_reader :original_gravity | |
# @param original_gravity [Float] 初期比重 | |
# @param suger_content [Float] 糖度 | |
def initialize(original_gravity: nil, suger_content: nil) | |
if original_gravity | |
@original_gravity = original_gravity | |
else | |
@original_gravity = suger_content * SUGER.original_gravity |
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
require 'uri' | |
require 'net/http' | |
class HttpCache | |
def initialize(path) | |
@path = path | |
if File.exists?(path) | |
load | |
else |
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
点数 | アルコール分 | 日本酒度 | エキス分 | 酸度 | アミノ酸度 | 酢酸イソアミル | カプロン酸エチル | 甘辛度 | 濃淡度 | ||
---|---|---|---|---|---|---|---|---|---|---|---|
北海道 | 5 | 15.64 | 2.7 | 4.74 | 1.20 | 1.20 | 0.94 | 3.30 | -0.06 | -0.89 | |
青森県 | 4 | 15.53 | 2.7 | 4.73 | 1.23 | 1.23 | 1.25 | 2.40 | -0.08 | -0.84 | |
岩手県 | 7 | 15.76 | 2.4 | 4.86 | 1.09 | 1.40 | 1.20 | 2.84 | 0.11 | -1.09 | |
宮城県 | 3 | 15.73 | 3.0 | 4.73 | 1.30 | 1.13 | 2.70 | 1.43 | -0.20 | -0.71 | |
秋田県 | 6 | 15.50 | 3.0 | 4.68 | 1.10 | 1.03 | 2.10 | 4.38 | 0.04 | -1.09 | |
山形県 | 8 | 16.10 | 3.4 | 4.76 | 1.30 | 1.28 | 1.65 | 3.36 | -0.09 | -0.66 | |
福島県 | 6 | 16.05 | 3.7 | 4.70 | 1.15 | 1.27 | 1.40 | 2.80 | -0.09 | -1.03 | |
茨城県 | 6 | 16.00 | 4.9 | 4.48 | 1.25 | 1.08 | 1.87 | 2.50 | -0.31 | -0.89 | |
栃木県 | 5 | 16.34 | 0.7 | 5.32 | 1.62 | 1.16 | 2.56 | 3.38 | -0.35 | -0.01 |
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 pandas as pd | |
data_frame = pd.read_csv('test.csv') | |
from sklearn import tree | |
classifier = tree.DecisionTreeClassifier(max_depth = 2) | |
clf = classifier.fit(data_frame.iloc[:,1:5], data_frame.iloc[:,5:6]) | |
f = tree.export_graphviz(clf, out_file = 'test.dot', feature_names = ["Kokugo", "Sansu", "Rika", "Shakai"], class_names = ["A", "C"], filled = True, rounded = True) |
NewerOlder