#!/home/rtheta/.pyenv/shims/python

# -*- coding: utf-8 -*-

import sys sys.path.append("/home/rtheta/.local/lib/python3.8/site-packages/") import pandas as pd import numpy as np import json import cgi from sklearn import linear_model

print("Content-type: application/json") print("\n\n")

data = sys.stdin.read() wine_df = pd.read_json(data)

#wineをjsonからcsvに変換

#wine_df.to_csv('/home/rtheta/kaiki/123456.csv', header=False, index=False) new_wine_df=wine_df[4:]

#test=wine_df.iloc[0].values

# sklearn.linear_model.LinearRegression クラスを読み込み clf = linear_model.LinearRegression()

# 説明変数 X = new_wine_df.iloc[:, [7]].values

# 目的変数 Y = new_wine_df[10].values

# 予測モデルを作成 clf.fit(X, Y)

# 回帰係数

#print(clf.coef_) a = clf.coef_[0]

# 切片 (誤差)

#print(clf.intercept_) b = clf.intercept_

# 決定係数

#print(clf.score(X, Y)) c = clf.score(X, Y)

#予測値(list) d=clf.predict(X)

predict_list = ["", "", "予測値", "float"] predict_list.extend(d) wine_df[new_wine_df.iloc[0, :].size]=pd.DataFrame(predict_list)

result = {"回帰係数":a,"切片":b,"決定係数":c}

#result = {"0":{"0":"回帰係数","1":a},"1":{"0":"切片","1":b},"2":{"0":"決定係数","1":c}}

#print(json.JSONEncoder().encode(result)+wine_df.T.to_json()) print(wine_df.T.to_json())

#print(json.JSONEncoder().encode(result)) print('\n') https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4927234/
https://www.jstage.jst.go.jp/article/qes/4/3/4_3/_article/-char/ja
https://www.jstage.jst.go.jp/result/global/-char/ja?languageKind=ja&item1=8&word1=%E7%94%B0%E5%8F%A3+%E7%8E%84%E4%B8%80&yearfrom=&cond1=2&translate=0&yearto=&bglobalSearch=false&fromPage=/search/global/_search/-char/ja
https://www.heisei-u.ac.jp/ba/fukui/pdf/analysis34.pdf
https://repository.kulib.kyoto-u.ac.jp/dspace/bitstream/2433/106108/1/0285-2.pdf
http://train.gomi.info/oatable/

=授業 水色=研究室内行事
月曜日火曜日水曜日木曜日金曜日
1-2研究会
3-4
5-6
7-8
9-10
11-14予備日

実験1に必要なファイル

#ref(): File not found: "sample.ino" at page "横井_backup"


トップ   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS