<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0" xmlns:blogChannel="http://backend.userland.com/blogChannelModule" >
  <channel>
  <title>揺動経路の記録</title>
  <link>https://stochaotic.blog.shinobi.jp/</link>
  <atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="https://stochaotic.blog.shinobi.jp/RSS/" />
  <description></description>
  <lastBuildDate>Mon, 17 Jun 2024 02:43:15 GMT</lastBuildDate>
  <language>ja</language>
  <copyright>© Ninja Tools Inc.</copyright>
  <atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" />

    <item>
    <title>test</title>
    <description>
    <![CDATA[<a href="//stochaotic.blog.shinobi.jp/File/work_20240615_cpy.zip" target="_blank">ダウンロード</a>]]>
    </description>
    <category>未選択</category>
    <link>https://stochaotic.blog.shinobi.jp/%E6%9C%AA%E9%81%B8%E6%8A%9E/test</link>
    <pubDate>Mon, 17 Jun 2024 02:43:15 GMT</pubDate>
    <guid isPermaLink="false">stochaotic.blog.shinobi.jp://entry/60</guid>
  </item>
    <item>
    <title>jsae</title>
    <description>
    <![CDATA[<a href="//stochaotic.blog.shinobi.jp/File/jsae_2021sp.zip" target="_blank">ダウンロード</a>]]>
    </description>
    <category>未選択</category>
    <link>https://stochaotic.blog.shinobi.jp/%E6%9C%AA%E9%81%B8%E6%8A%9E/jsae</link>
    <pubDate>Mon, 31 May 2021 13:01:21 GMT</pubDate>
    <guid isPermaLink="false">stochaotic.blog.shinobi.jp://entry/59</guid>
  </item>
    <item>
    <title>test</title>
    <description>
    <![CDATA[<a href="//stochaotic.blog.shinobi.jp/File/f2550268.zip" target="_blank">ダウンロード</a>]]>
    </description>
    <category>未選択</category>
    <link>https://stochaotic.blog.shinobi.jp/%E6%9C%AA%E9%81%B8%E6%8A%9E/test_58</link>
    <pubDate>Sun, 08 Nov 2020 15:36:16 GMT</pubDate>
    <guid isPermaLink="false">stochaotic.blog.shinobi.jp://entry/58</guid>
  </item>
    <item>
    <title>テスト</title>
    <description>
    <![CDATA[https://stochaotic.blog.shinobi.jp/File/scan-2003232002<br />
https://stochaotic.blog.shinobi.jp/File/scan-2003232004]]>
    </description>
    <category>未選択</category>
    <link>https://stochaotic.blog.shinobi.jp/%E6%9C%AA%E9%81%B8%E6%8A%9E/%E3%83%86%E3%82%B9%E3%83%88</link>
    <pubDate>Mon, 23 Mar 2020 11:49:34 GMT</pubDate>
    <guid isPermaLink="false">stochaotic.blog.shinobi.jp://entry/56</guid>
  </item>
    <item>
    <title>小ネタ</title>
    <description>
    <![CDATA[<div>一日を15分刻みにした1次元配列で取り扱う<br />
<br />
------------------------------------------------------------------------------<br />
import datetime</div><div>import pandas as pd<br />
<div>timestamp_index = []</div><div>timestamp_list = [0]*24*4</div><div>for val1 in range(0, 24,1):</div><div>&nbsp; &nbsp; for val2 in [0,15,30, 45]:</div><div>&nbsp; &nbsp; &nbsp; &nbsp; timestamp_index.append('{0:02d}:{1:02d}'.format(val1, val2))</div><div>df = pd.DataFrame(timestamp_list, index=time_stamp_index, columns=['counts'])<br />
<div>timestamp = datetime.datetime.strptime('2020/1/1 11:43:00', '%Y/%m/%d %H:%M:%S' )</div><div>idx = timestamp.hour*4 + int(timestamp.minute / 15)<br />
<div>df.iloc[idx] += 1</div><div>df.iloc[idx]</div></div></div></div>]]>
    </description>
    <category>プログラミング</category>
    <link>https://stochaotic.blog.shinobi.jp/%E3%83%97%E3%83%AD%E3%82%B0%E3%83%A9%E3%83%9F%E3%83%B3%E3%82%B0/%E5%B0%8F%E3%83%8D%E3%82%BF</link>
    <pubDate>Tue, 11 Feb 2020 13:40:08 GMT</pubDate>
    <guid isPermaLink="false">stochaotic.blog.shinobi.jp://entry/55</guid>
  </item>
    <item>
    <title>ModuleNotFoundError問題</title>
    <description>
    <![CDATA[機会学習モデルをpklで保存したあとに、クラスオブジェクト情報などを一緒に格納しようとしたときに生じうるエラー<br />
<br />
保存するときの構成が引き継がれてしまう。実際にpklのバイナリを確認してみるとディレクトリ構成の情報が入っていることがわかる<br />
<br />
解決策？<br />
<br />
https://stackoverflow.com/questions/2121874/python-pickling-after-changing-a-modules-directory<br />
<br />
<br />
<pre class="lang-py prettyprint prettyprinted"><code><span class="kwd">import</span><span class="pln"> sys<br />
</span><span class="kwd">from</span><span class="pln"> whyteboard </span><span class="kwd">import</span><span class="pln"> tools<br />
<br />
sys</span><span class="pun">.</span><span class="pln">modules</span><span class="pun">[</span><span class="str">'tools'</span><span class="pun">]</span><span class="pln"> </span><span class="pun">=</span><span class="pln"> tools</span></code></pre>]]>
    </description>
    <category>プログラミング</category>
    <link>https://stochaotic.blog.shinobi.jp/%E3%83%97%E3%83%AD%E3%82%B0%E3%83%A9%E3%83%9F%E3%83%B3%E3%82%B0/modulenotfounderror%E5%95%8F%E9%A1%8C</link>
    <pubDate>Wed, 27 Feb 2019 11:39:16 GMT</pubDate>
    <guid isPermaLink="false">stochaotic.blog.shinobi.jp://entry/53</guid>
  </item>
    <item>
    <title>GBDTを利用した特徴量変換スクリプト</title>
    <description>
    <![CDATA[サンプルコード<br />
<pre style="background-color: #2b2b2b; color: #a9b7c6; font-family: 'ＭＳ ゴシック'; font-size: 9.0pt;"><span style="color: #cc7832;">import </span>numpy <span style="color: #cc7832;">as </span>np<br />
<br />
<span style="color: #cc7832;">from </span>sklearn.ensemble <span style="color: #cc7832;">import </span>GradientBoostingClassifier<br />
<span style="color: #cc7832;">from </span>sklearn.model_selection <span style="color: #cc7832;">import </span>GridSearchCV<br />
<span style="color: #cc7832;">from </span>sklearn.datasets <span style="color: #cc7832;">import </span>load_iris<br />
<br />
<span style="color: #cc7832;">def </span><span style="color: #ffc66d;">feature_transformation</span>(gscv<span style="color: #cc7832;">, </span>x):<br />
  ret = [gscv.best_estimator_.estimators_[i<span style="color: #cc7832;">, </span><span style="color: #6897bb;">0</span>].tree_.apply(x.astype(np.float32)) <span style="color: #cc7832;">for </span>i <span style="color: #cc7832;">in<br />
</span><span style="color: #cc7832;">     </span><span style="color: #8888c6;">range</span>(gscv.best_estimator_.n_estimators)]<br />
  <span style="color: #cc7832;">return </span>np.array(ret)<br />
<br />
<span style="color: #cc7832;">def </span><span style="color: #ffc66d;">ft_gbdt</span>():<br />
  data = load_iris()<br />
<br />
  x = data[<span style="color: #6a8759;">'data'</span>]<br />
  y = data[<span style="color: #6a8759;">'target'</span>]<br />
  x_train = x[<span style="color: #6897bb;">0</span>:<span style="color: #6897bb;">130</span>]<br />
  x_test = x[<span style="color: #6897bb;">130</span>:<span style="color: #6897bb;">150</span>]<br />
  y_train = y[<span style="color: #6897bb;">0</span>:<span style="color: #6897bb;">130</span>]<br />
  y_test = y[<span style="color: #6897bb;">130</span>:<span style="color: #6897bb;">150</span>]<br />
<br />
  <span style="color: #8888c6;">print</span>(<span style="color: #6a8759;">"x:{}"</span>.format(np.array(x).shape))<br />
  <span style="color: #8888c6;">print</span>(<span style="color: #6a8759;">"y:{}"</span>.format(np.array(y).shape))<br />
<br />
  <span style="color: #808080;"># tune hyper parameters first<br />
</span><span style="color: #808080;">    </span>model = GradientBoostingClassifier(<span style="color: #aa4926;">n_estimators</span>=<span style="color: #6897bb;">1000</span>)<br />
  parameters = {<span style="color: #6a8759;">'learning_rate' </span>: [<span style="color: #6897bb;">0.1</span>]<span style="color: #cc7832;">,<br />
</span><span style="color: #cc7832;">                  </span><span style="color: #6a8759;">'max_depth'</span>: [<span style="color: #6897bb;">4</span><span style="color: #cc7832;">, </span><span style="color: #6897bb;">6</span>]<span style="color: #cc7832;">,<br />
</span><span style="color: #cc7832;">                  </span><span style="color: #6a8759;">'min_samples_leaf'</span>: [<span style="color: #6897bb;">3</span><span style="color: #cc7832;">, </span><span style="color: #6897bb;">5</span>]<span style="color: #cc7832;">,<br />
</span><span style="color: #cc7832;">                  </span><span style="color: #6a8759;">'max_features'</span>: [<span style="color: #6897bb;">1.0</span>]}<br />
<br />
  gscv = GridSearchCV(model<span style="color: #cc7832;">, </span>parameters<span style="color: #cc7832;">, </span><span style="color: #aa4926;">verbose</span>=<span style="color: #6897bb;">10</span><span style="color: #cc7832;">, </span><span style="color: #aa4926;">n_jobs</span>=-<span style="color: #6897bb;">1</span><span style="color: #cc7832;">, </span><span style="color: #aa4926;">cv</span>=<span style="color: #6897bb;">4</span>)<br />
  gscv.fit(x_train<span style="color: #cc7832;">, </span>y_train)<br />
  <span style="color: #8888c6;">print</span>(<span style="color: #6a8759;">"score:{}"</span>.format(gscv.score(x_test<span style="color: #cc7832;">, </span>y_test)))<br />
<br />
  # ------------------------------------------------<br />
  ret = feature_transformation(gscv<span style="color: #cc7832;">, </span>x_test)<br />
<br />
  <span style="color: #8888c6;">print</span>(<span style="color: #6a8759;">"ret:{}"</span>.format(ret))</pre>]]>
    </description>
    <category>未選択</category>
    <link>https://stochaotic.blog.shinobi.jp/%E6%9C%AA%E9%81%B8%E6%8A%9E/gbdt%E3%82%92%E5%88%A9%E7%94%A8%E3%81%97%E3%81%9F%E7%89%B9%E5%BE%B4%E9%87%8F%E5%A4%89%E6%8F%9B%E3%82%B9%E3%82%AF%E3%83%AA%E3%83%97%E3%83%88</link>
    <pubDate>Mon, 09 Jul 2018 15:57:23 GMT</pubDate>
    <guid isPermaLink="false">stochaotic.blog.shinobi.jp://entry/48</guid>
  </item>
    <item>
    <title>webcrawing scripts</title>
    <description>
    <![CDATA[<a href="//stochaotic.blog.shinobi.jp/File/webcrawling.zip" target="_blank">ダウンロード</a>]]>
    </description>
    <category>未選択</category>
    <link>https://stochaotic.blog.shinobi.jp/%E6%9C%AA%E9%81%B8%E6%8A%9E/webcrawing%20scripts</link>
    <pubDate>Sun, 01 Apr 2018 12:47:38 GMT</pubDate>
    <guid isPermaLink="false">stochaotic.blog.shinobi.jp://entry/47</guid>
  </item>
    <item>
    <title>next+++</title>
    <description>
    <![CDATA[<a href="//stochaotic.blog.shinobi.jp/File/NEXT.ZIP" target="_blank">ダウンロード</a>]]>
    </description>
    <category>未選択</category>
    <link>https://stochaotic.blog.shinobi.jp/%E6%9C%AA%E9%81%B8%E6%8A%9E/next---</link>
    <pubDate>Wed, 28 Mar 2018 15:25:01 GMT</pubDate>
    <guid isPermaLink="false">stochaotic.blog.shinobi.jp://entry/46</guid>
  </item>
    <item>
    <title>next++</title>
    <description>
    <![CDATA[<a href="//stochaotic.blog.shinobi.jp/File/NEXT.ZIP" target="_blank">ダウンロード</a>]]>
    </description>
    <category>未選択</category>
    <link>https://stochaotic.blog.shinobi.jp/%E6%9C%AA%E9%81%B8%E6%8A%9E/next--</link>
    <pubDate>Tue, 27 Mar 2018 16:56:18 GMT</pubDate>
    <guid isPermaLink="false">stochaotic.blog.shinobi.jp://entry/45</guid>
  </item>

    </channel>
</rss>