<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
    <channel>
        <title>mk-43.log</title>
        <link>https://velog.io/</link>
        <description></description>
        <lastBuildDate>Thu, 25 May 2023 06:59:46 GMT</lastBuildDate>
        <docs>https://validator.w3.org/feed/docs/rss2.html</docs>
        <generator>https://github.com/jpmonette/feed</generator>
        <image>
            <title>mk-43.log</title>
            <url>https://velog.velcdn.com/images/mk-43/profile/2abee403-83d1-4ee8-9a24-4008fe9d227b/social_profile.png</url>
            <link>https://velog.io/</link>
        </image>
        <copyright>Copyright (C) 2019. mk-43.log. All rights reserved.</copyright>
        <atom:link href="https://v2.velog.io/rss/mk-43" rel="self" type="application/rss+xml"/>
        <item>
            <title><![CDATA[TypeScript]]></title>
            <link>https://velog.io/@mk-43/TypeScript</link>
            <guid>https://velog.io/@mk-43/TypeScript</guid>
            <pubDate>Thu, 25 May 2023 06:59:46 GMT</pubDate>
            <description><![CDATA[<h3 id="typing방법">Typing방법</h3>
<ol>
<li>type alias</li>
</ol>
<pre><code class="language-ts">type NewsFeed = News &amp; {
  comments_count: number;
  points: number;
  read?: boolean;
}</code></pre>
<ol start="2">
<li>interface<pre><code class="language-ts">interface NewsFeed extends News {
readonly comments_count: number;
readonly points: number;
read?: boolean; // optional
}</code></pre>
</li>
</ol>
<p>타입을 조합시키는 방법이 다름 -&gt; &amp; 활용X</p>
]]></description>
        </item>
        <item>
            <title><![CDATA[loc vs. iloc]]></title>
            <link>https://velog.io/@mk-43/loc-vs.-iloc</link>
            <guid>https://velog.io/@mk-43/loc-vs.-iloc</guid>
            <pubDate>Thu, 18 May 2023 13:37:15 GMT</pubDate>
            <description><![CDATA[<h3 id="loc-label-based-or-boolean-array---이름-기준">loc: label-based (or boolean array) -&gt; 이름 기준</h3>
<pre><code class="language-python">loc[행 인덱싱 값, 열 인덱싱 값]
loc[&#39;2020-04-09&#39;, &#39;column_name&#39;]

## multiple conditions
df.loc[
    (df.Humidity &gt; 50) &amp; (df.Weather == &#39;Shower&#39;), 
    [&#39;Temperature&#39;,&#39;Wind&#39;],
]</code></pre>
<h3 id="iloc-integer-postion-based-or-boolean-array---순서인덱스-기준">iloc: integer postion-based (or boolean array) -&gt; 순서(인덱스) 기준</h3>
<pre><code class="language-python">iloc[row_postion, column_position]

# Getting ValueError
df.iloc[df.Humidity &gt; 50, :]    # error

# Single condition
df.iloc[list(df.Humidity &gt; 50)]</code></pre>
<p><img src="https://miro.medium.com/v2/resize:fit:1100/format:webp/1*CgAWzayEQY8PQuMpRkSGfQ.png" alt="img"></p>
]]></description>
        </item>
        <item>
            <title><![CDATA[Random Forest]]></title>
            <link>https://velog.io/@mk-43/Random-Forest</link>
            <guid>https://velog.io/@mk-43/Random-Forest</guid>
            <pubDate>Thu, 18 May 2023 13:16:27 GMT</pubDate>
            <description><![CDATA[<p><em>min_samples_split</em> 분할할 수 있는 샘플수
<em>min_samples_leaf</em> 분할해서 leaf가 될 수 있는 샘플수</p>
<p>min_samples_split=6, min_samples_leaf=4
-&gt; 샘플수가 6개이면, 분할을 시도하나, 분할 결과 개별 클래스 값이 3개씩이면 min_samples_leaf 조건을 만족하지 않아 분할하지 않는다.</p>
<p><em>feature_importances_</em> 
The impurity-based feature importances.</p>
]]></description>
        </item>
        <item>
            <title><![CDATA[covariance]]></title>
            <link>https://velog.io/@mk-43/covariance</link>
            <guid>https://velog.io/@mk-43/covariance</guid>
            <pubDate>Thu, 18 May 2023 13:11:41 GMT</pubDate>
            <description><![CDATA[<p><img src="https://velog.velcdn.com/images/mk-43/post/6a1acb05-fb5b-4347-a0a1-f9baa44575fa/image.png" alt=""></p>
<p><img src="https://velog.velcdn.com/images/mk-43/post/7cbbb38d-a951-4235-944d-b1fa04310978/image.png" alt=""></p>
]]></description>
        </item>
        <item>
            <title><![CDATA[pandas code]]></title>
            <link>https://velog.io/@mk-43/pandas</link>
            <guid>https://velog.io/@mk-43/pandas</guid>
            <pubDate>Wed, 17 May 2023 07:36:44 GMT</pubDate>
            <description><![CDATA[<p>import</p>
<pre><code class="language-python">import pandas as pd
import numpy as np
import math

from sklearn.preprocessing import StandardScaler

from scipy.stats import pearsonr

from sklearn.linear_model import LinearRegression
from sklearn.ensemble import RandomForestRegressor
</code></pre>
<p>KMeans</p>
<pre><code class="language-python">from sklearn.cluster import KMeans
from sklearn.metrics import silhouette_score

for k in range(2, 10):
    model = KMeans(n_clusters= k, random_state=1)
    model.fit(X = df.drop(columns=&#39;X1&#39;))
    score= silhouette_score(X=df.drop(columns=&#39;X1&#39;), labels=model.labels_)

# predict3_4 = KMeans(random_state=1234, n_clusters=4, n_init = 50, max_iter = 300).fit(train3).predict(train3).tolist()

# predict(train_set) == labels_</code></pre>
<p>Data Split</p>
<pre><code class="language-python">from sklearn.model_selection import train_test_split
tr, tet = train_test_split(q3, test_size=0.01, random_state=229)

X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.33, random_state=42)</code></pre>
<p>Linear Regression</p>
<pre><code class="language-python">model = LinearRegression(fit_intercept=True)
model.fit(X=df.drop(columns=[&#39;apt_code&#39;]),  y = df[&#39;Y&#39;])

pred = model.predict(X = test_df.drop(columns=[&#39;apt_code&#39;, &#39;Y&#39;]))</code></pre>
<p>KNN</p>
<pre><code class="language-python">from sklearn.model_selection import train_test_split  
from sklearn.neighbors import KNeighborsClassifier    

neigh = KNeighborsClassifier(p=1, weights=&#39;distance&#39;)
neigh.fit(tr2[[&#39;X2&#39;]], tr2[[&#39;y&#39;]])</code></pre>
<p>Scaler</p>
<pre><code class="language-python">from sklearn.preprocessing import StandardScaler
scaler = StandardScaler() # MinMaxScaler()
scaler.fit(X = tr.loc[:, &#39;X1&#39;:&#39;X2&#39;])
train_set.loc[:, &#39;X1&#39;:&#39;X2&#39;] = scaler.transform(X = train_set.loc[:, &#39;X1&#39;:&#39;X2&#39;])

# scaler.fit_transform(X = train_set.loc[:, &#39;X1&#39;:&#39;X2&#39;])

# var3 = [&#39;GRE&#39;, &#39;TOEFL&#39;, &#39;SOP&#39;, &#39;LOR&#39;, &#39;CGPA&#39;]
# pd.DataFrame(MinMaxScaler().fit_transform(df3_d[var3]), columns=var3)</code></pre>
<p>KFold</p>
<pre><code class="language-python">from sklearn.model_selection import KFold
kf = KFold(n_splits=5)
for train, test in kf.split(d):
    print(test, train)</code></pre>
<pre><code>[0 1] [2 3 ..]
[2 3] [0 1 4 5 ..] </code></pre><p>Corr/Cov</p>
<pre><code class="language-python">df.corr(method=&#39;pearson&#39;)
df.Col1.corr(df.Col2)

df.cov()</code></pre>
<p>Math</p>
<p>Random Forest</p>
<pre><code class="language-python">from sklearn.ensemble import RandomForestRegressor
rf_a = RandomForestRegressor(random_state=1234, n_estimators = 10, min_samples_leaf = 10)

train_a_y = df6_a[&#39;SCORE&#39;]
train_a_x = df6_a.drop(columns=[&#39;EMP_ID&#39;,&#39;SCORE&#39;])

rf_a.fit(train_a_x, train_a_y)
a_fi = rf_a.feature_importances_</code></pre>
<p>rank</p>
<pre><code class="language-python">df[[&#39;GRE&#39;]].rank(method=&#39;min&#39;, ascending=False)</code></pre>
<p>apply &amp; drop</p>
<pre><code class="language-python">df2[&#39;outlier&#39;]=df2[&#39;TOEFL&#39;].apply(lambda x : 1 if (x&lt;q1-1.5*iqr)|(x&gt;q3+1.5*iqr) else 0)
df2=df2[df2[&#39;outlier&#39;]==0].drop(&#39;outlier&#39;,axis=1)</code></pre>
<p>reset_index</p>
<pre><code class="language-python">pd.concat([df3_d, df3[&#39;RESEARCH&#39;].reset_index(drop=True)])</code></pre>
<p>value_counts &amp; find max</p>
<pre><code class="language-python"># list X
# DataFrame, Series O

# for list
pd.DataFrame(list).value_counts()
list.count(max(list, key=list.count))

pd.DataFrame(predict3_5).value_counts().max()
pd.DataFrame(predict3_5).value_counts().idxmax()[0]

max(predict3_5, key=predict3_5.count)

max(&#39;apple&#39;, &#39;Pear&#39;, key=lambda x: x.upper())
&quot;ABCAB&quot;.count(&quot;A&quot;, 1)

max (collection[, key])
&gt;&gt;&gt; max(&#39;apple&#39;, &#39;Pear&#39;, key=lambda x: x.upper())
&#39;Pear&#39;
&gt;&gt;&gt; max(&#39;apple&#39;, &#39;Pear&#39;)
&#39;apple&#39;</code></pre>
<p>accuray</p>
<pre><code class="language-python">from sklearn.metrics import accuracy_score
A22 = accuracy_score(y_train,predict2)*100</code></pre>
<p>get_dummies</p>
<pre><code class="language-python">dummies3 = pd.get_dummies(df3[&#39;UNIV_RATING&#39;], drop_first=True).reset_index(drop=True)</code></pre>
<p>range 설정</p>
<pre><code class="language-python"># Step 2-3
tmp = 0
res = []
for i in range(6):
    lb = tmp
    ub = tmp+200
    test = df2_1[(df2_1[&#39;CUST_ID&#39;] &gt; lb) &amp; (df2_1[&#39;CUST_ID&#39;] &lt;= ub)]
    train = df2_1[((df2_1[&#39;CUST_ID&#39;] &gt; 0) &amp; (df2_1[&#39;CUST_ID&#39;] &lt;=lb)) | ((df2_1[&#39;CUST_ID&#39;] &gt; ub) &amp; (df2_1[&#39;CUST_ID&#39;] &lt;= 1200))]    
    train_x = train.drop(columns = [&#39;CUST_ID&#39;, &#39;SATISFACTION&#39;])
    train_y = train[[&#39;SATISFACTION&#39;]]

    test_x = test.drop(columns = [&#39;CUST_ID&#39;, &#39;SATISFACTION&#39;])
    test_y = test[[&#39;SATISFACTION&#39;]]

    lr = LogisticRegression(solver = &#39;newton-cg&#39;, C=100000, random_state=1234)
    lr.fit(train_x, train_y)
#     print(test[&#39;CUST_ID&#39;].min(), test[&#39;CUST_ID&#39;].max())
    test_y[&#39;prd&#39;] = lr.predict(test_x)
    res.append(accuracy_score(test_y[&#39;SATISFACTION&#39;], test_y[&#39;prd&#39;]))
    tmp = tmp + 200
D = sum(res)/6</code></pre>
]]></description>
        </item>
        <item>
            <title><![CDATA[준동사]]></title>
            <link>https://velog.io/@mk-43/%EC%A4%80%EB%8F%99%EC%82%AC</link>
            <guid>https://velog.io/@mk-43/%EC%A4%80%EB%8F%99%EC%82%AC</guid>
            <pubDate>Sun, 05 Jun 2022 09:40:12 GMT</pubDate>
            <description><![CDATA[<p>준동사: 동사가 <strong>주절의 술어부가 아닌</strong> 다른 곳에서 표현될 때 나타나는 <strong>여러 동사의 형태</strong>를 의미</p>
<p>살다 -&gt; 사는 것, 살기</p>
<ol>
<li><p>부정사
1.1. 명사
1.2. 형용사
1.3. 부사</p>
</li>
<li><p>동명사
2.1. 명사</p>
</li>
<li><p>분사(현재/과거)
3.1. 형용사
3.2. 부사</p>
</li>
<li><p>to부정사
4.1. 명사: ~하기
4.2. 형용사: ~할/하는
4.3. 부사: ~하기 위해서, ~하기 때문에</p>
</li>
</ol>
<hr>
<ol>
<li>명사<ol>
<li>주어</li>
<li>보어: 설명의 보충해주는 말(주격/목적격)
<strong>The first thing</strong> you should do is <strong>to push this button</strong>
-&gt; The first thing = to push this button<blockquote>
<p>He became a teacher (되었다 =&gt; 불완전자동사 =&gt; 주격보어 =&gt; He = teacher)
He made me a teacher (me = a teacher)</p>
</blockquote>
</li>
<li>목적어</li>
</ol>
</li>
</ol>
]]></description>
        </item>
        <item>
            <title><![CDATA[Learning Curve]]></title>
            <link>https://velog.io/@mk-43/Learning-Curve</link>
            <guid>https://velog.io/@mk-43/Learning-Curve</guid>
            <pubDate>Tue, 26 Apr 2022 12:48:34 GMT</pubDate>
            <description><![CDATA[<p><img src="https://velog.velcdn.com/images/mk-43/post/ea798f51-ea47-48ab-9440-523195dcdce9/image.png" alt=""></p>
<p><img src="https://velog.velcdn.com/images/mk-43/post/5143b296-c028-443f-824b-a73856d6c5be/image.png" alt=""></p>
]]></description>
        </item>
        <item>
            <title><![CDATA[S3]]></title>
            <link>https://velog.io/@mk-43/S3</link>
            <guid>https://velog.io/@mk-43/S3</guid>
            <pubDate>Mon, 18 Apr 2022 08:30:08 GMT</pubDate>
            <description><![CDATA[<p><img src="https://velog.velcdn.com/images/mk-43/post/61b56938-c2bb-4c2a-b317-5f9b66ae8259/image.png" alt=""></p>
]]></description>
        </item>
        <item>
            <title><![CDATA[italics]]></title>
            <link>https://velog.io/@mk-43/italics</link>
            <guid>https://velog.io/@mk-43/italics</guid>
            <pubDate>Sat, 16 Apr 2022 16:58:04 GMT</pubDate>
            <description><![CDATA[<p>used to denote titles and names of particular works or objects.</p>
]]></description>
        </item>
        <item>
            <title><![CDATA[apt vs. pip]]></title>
            <link>https://velog.io/@mk-43/apt-vs.-pip</link>
            <guid>https://velog.io/@mk-43/apt-vs.-pip</guid>
            <pubDate>Sat, 16 Apr 2022 16:50:41 GMT</pubDate>
            <description><![CDATA[<p><strong>apt</strong> installs python modules in <strong>system-wide</strong> location</p>
<p><strong>pip</strong> is a standard package manager</p>
]]></description>
        </item>
        <item>
            <title><![CDATA[OpenCV]]></title>
            <link>https://velog.io/@mk-43/OpenCV</link>
            <guid>https://velog.io/@mk-43/OpenCV</guid>
            <pubDate>Sat, 16 Apr 2022 12:28:40 GMT</pubDate>
            <description><![CDATA[<h3 id="opencv">OpenCV</h3>
<p>Open source computer vision library written in C and C++.</p>
<h3 id="computer-vision">Computer vision</h3>
<p>the transformation of data from a still or video camera into either a decision or a new representation.</p>
<p>a decision: perform a concrete task
a new representation: a new image</p>
<p>OpenCV는 BGR형태로 읽음</p>
<h3 id="how-to-install">How to install</h3>
<pre><code class="language-bash"># create virtual env first

# then
pip install opencv-python
</code></pre>
]]></description>
        </item>
        <item>
            <title><![CDATA[Study]]></title>
            <link>https://velog.io/@mk-43/Study</link>
            <guid>https://velog.io/@mk-43/Study</guid>
            <pubDate>Sat, 16 Apr 2022 11:30:49 GMT</pubDate>
            <description><![CDATA[<h3 id="dl">DL</h3>
<ul>
<li>Coursera - Andrew Ng</li>
<li>Computer Vision</li>
</ul>
<h3 id="cloud">Cloud</h3>
<ul>
<li>AWS</li>
</ul>
<h3 id="web">Web</h3>
<ul>
<li>Front end<ul>
<li>React<ul>
<li>리액트를 다루는 기술</li>
</ul>
</li>
</ul>
</li>
<li>Spring</li>
</ul>
]]></description>
        </item>
        <item>
            <title><![CDATA[pipenv]]></title>
            <link>https://velog.io/@mk-43/pipenv</link>
            <guid>https://velog.io/@mk-43/pipenv</guid>
            <pubDate>Sat, 16 Apr 2022 09:00:37 GMT</pubDate>
            <description><![CDATA[<p><strong>pipenv</strong> is a dependency manager for python projects.  </p>
<p><strong>pipx</strong> is a tool to help you install and run end-user applications written in python.</p>
<table>
<thead>
<tr>
<th>pip</th>
<th>pipx</th>
</tr>
</thead>
<tbody><tr>
<td>for both libraries and apps</td>
<td>specifically for app installation</td>
</tr>
</tbody></table>
<pre><code class="language-bash">sudo apt install python3-pip # install pip
</code></pre>
]]></description>
        </item>
        <item>
            <title><![CDATA[CV]]></title>
            <link>https://velog.io/@mk-43/CV</link>
            <guid>https://velog.io/@mk-43/CV</guid>
            <pubDate>Fri, 15 Apr 2022 15:51:49 GMT</pubDate>
            <description><![CDATA[<p><code>frame rate</code> 두 프레임 간 시간</p>
<p><code>PSNR (Peek Siganl-to-Noise Ratio</code> </p>
<p><img src="https://velog.velcdn.com/images/mk-43/post/1c67b38a-7eb2-4a90-bfa2-def9c923dfce/image.png" alt=""></p>
]]></description>
        </item>
    </channel>
</rss>