<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by First350 on Medium]]></title>
        <description><![CDATA[Stories by First350 on Medium]]></description>
        <link>https://medium.com/@First350?source=rss-e01c955eec0------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*INb7aqARnzjX28M0NWQq1w.jpeg</url>
            <title>Stories by First350 on Medium</title>
            <link>https://medium.com/@First350?source=rss-e01c955eec0------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 16:49:17 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@First350/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[分享沒有門檻]]></title>
            <link>https://medium.com/@First350/%E5%88%86%E4%BA%AB%E6%B2%92%E6%9C%89%E9%96%80%E6%AA%BB-897c7d52cec?source=rss-e01c955eec0------2</link>
            <guid isPermaLink="false">https://medium.com/p/897c7d52cec</guid>
            <dc:creator><![CDATA[First350]]></dc:creator>
            <pubDate>Sun, 25 Feb 2018 15:00:06 GMT</pubDate>
            <atom:updated>2018-02-25T15:05:03.140Z</atom:updated>
            <content:encoded><![CDATA[<p>這禮拜參加了Jack的音樂聚會，這場音樂聚會的核心就是：音樂是沒有門檻的，不會唱歌不會樂器也可以單純插著手機分享。聽音樂可以聽得很匠氣也可以只是聽開心的，我想只要是有用心感受的真實的都是值得分享的。就算NickelBack被批評得這麼慘我還是滿喜歡他們的哈哈，雖然曲風平實、歌詞不特別但是就是能打到我！</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qh4MZL_e20fN4th8wpBdoQ.jpeg" /><figcaption>Jack 音樂分享！2/27在河岸留言有演出喔</figcaption></figure><p>Jack這個音樂會的精神其實也是用在讀書會吧！其實分享就是雙向的，我幾乎永遠都能在別人給我的回饋中找到些有用的資訊，不論是單純的猜測或是援引文獻的質疑或評論，都能讓我找到新的角度去看這個問題。有時候我會過度鑽牛角尖在一些細微的差異上，但真正的問題可能在別的地方。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AsU2PTBPNp1tMlMWqSy7vQ.jpeg" /><figcaption>Mike的分享</figcaption></figure><p>就我自己來說，其實我也不是特別喜歡分享想法的人，好像內心永遠有個第三者在旁邊評論我一樣，當自己想法不是100%確定的時候就是不敢表示。怕問了蠢問題，暴露出自己的無知。這樣好像造就了一種跟風的心態，只要和大家想的一樣好像就沒有問題了。我覺得很多可能性好像就這樣失去了！做分享或是presentation的時候常常被問問題，也是促使我重新的思考一次！如果讀書會中有人看到相似的paper也就可以直接上來分享，其實也不需要很詳細的投影片或是了解得多透徹，常常我們就五、六個人一起在那邊研究，自己不懂的地方馬上有五個人幫你一起解決，問一個問題的投資報酬率實在很大啊！</p><p>禮拜六的小聚會，我們成為彼此的智庫，在這個空間裡成就彼此</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e2TttdrDMZECVuCIvukTQQ.jpeg" /></figure><p><a href="https://www.instagram.com/node_real_life/">Node伴居本 (@node_real_life) * Instagram photos and videos</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=897c7d52cec" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[讀書會-ＷorkShop]]></title>
            <link>https://medium.com/@First350/%E8%AE%80%E6%9B%B8%E6%9C%83-%EF%BD%97orkshop-f2bc3727ffb3?source=rss-e01c955eec0------2</link>
            <guid isPermaLink="false">https://medium.com/p/f2bc3727ffb3</guid>
            <dc:creator><![CDATA[First350]]></dc:creator>
            <pubDate>Sun, 21 Jan 2018 16:46:31 GMT</pubDate>
            <atom:updated>2018-01-22T02:29:21.232Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*r_kYCpDY78Px1EJs_x60Yw.png" /></figure><p>這禮拜六的讀書會有些特別，除了原本成員們的分享外還多了一項議程，就是舉辦worshop。其實workshop雖然講起來並不是那麼正式，但想一想準備工作還是多的嚇人的。去年因緣際會也有參加過國際型的workshop，那形式實在不是我們這幾個人可以實現的，包括poster、demo還有大師演講等等。我們要怎麼在有限的資源和人力之下進行有效率的交流就是這禮拜的核心重點。</p><p>理想中workshop不會是只有單方面的教學，每個參與人一定帶著強烈的動機並切針對特定的主題(Segmentation, Object detection, GAN …)。可以是輕鬆學術交流的模式，互相分享研究成果、提出想法。 就和我們想在讀書會中成就的一樣，讓合作有可能跨校或是跨研究室的發生，在交流的同時彼此刺激。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mEB_eyuaGA8i0biT2wVvFA.jpeg" /><figcaption>在這個空間一起發想…</figcaption></figure><p>一起辦workshop對於我來說有更深一層意義，我們的合作關係會更往上一層，而且這禮拜的討論也讓我瞭解到大家內心中的熱情，雖然目前力量微小但卻非常想貢獻什麼。</p><p>Mike在提供想法時不斷強調如何幫助他在不同領域的朋友們也能了解這波人工智慧浪潮所帶來的改變。Howard 和葉醫師則提到了業界和學界的結合、分享目前在舉辦的教育項目的優勢和不足，嘗試討論出我們再這樣環境下的定位。這些討論遠比我想像的要深得多，其中一的一些發想老實說已經超出原本目標了，但這其實也是一種嘗試！我覺得在這些領域努力的人已經很多了，缺少的是把這些人凝聚再一起的力量，如果我們這五六的人就已經能產生這麼大的火花，那讓這樣的形式得以繼續擴大匯市多麼讓人興奮的一件事！</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e2TttdrDMZECVuCIvukTQQ.jpeg" /></figure><p><a href="https://www.instagram.com/node_real_life/">Node伴居本 (@node_real_life) * Instagram photos and videos</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f2bc3727ffb3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[電影聚]]></title>
            <link>https://medium.com/@First350/%E9%9B%BB%E5%BD%B1%E8%81%9A-3297a070985?source=rss-e01c955eec0------2</link>
            <guid isPermaLink="false">https://medium.com/p/3297a070985</guid>
            <category><![CDATA[電影]]></category>
            <category><![CDATA[科技]]></category>
            <category><![CDATA[影評]]></category>
            <category><![CDATA[聚會]]></category>
            <category><![CDATA[生活]]></category>
            <dc:creator><![CDATA[First350]]></dc:creator>
            <pubDate>Mon, 15 Jan 2018 01:45:03 GMT</pubDate>
            <atom:updated>2018-01-16T05:44:38.814Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*C2OmG5CE6DUb1kJNOKRrwQ.jpeg" /><figcaption>Muse也在看</figcaption></figure><p>看電影對我來說一直只是個消遣，通常也是跟隨主流商業電影偶爾看看，得到的感想好像也只分好看、不好看，看完後隨手參考下網路上的心得，也沒什麼用心去推敲。大概到去年，意外被推薦到Youtube的頻道Every Frame a Painting，才大概知道導演如何運用電影的剪接手法和畫面的構圖來塑造整部片的氛圍、人物的心理狀態等等。可惜在頻道停止更新之後我也沒有在接觸到這部分的資訊了。</p><p>這禮拜是第三次和Colin一起看電影，其實第一次聚會是看“駭客任務”重溫小時候的科幻神片，加上現在對於AI和科技的想像越來越逼近，第二次看的震撼其實不小，又看到網路上以系統的概念來剖析錫安城、先知和救世主等等的角色，其實是又再重新看了一次的感覺。而Colin的看法會去從哲學和文學角度、加上各種旁徵博引，講到其他想表達類似概念和哲學的電影等等，讓我和Jerry有不小的震撼。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EJLXOy6EdfzfMMElzYHtcg.jpeg" /></figure><p>接下來藉由他的推薦我們一起看了“生命中最抓狂的小事”，有了上次的經驗這次有特別去留意畫面中的細節，一節一節的小故事雖然都非常精彩，但在觀影的過程中我一直想把它串接再一起，想說最後各個故事一定會以一個形式串在一起！然而看到最後還是沒有找到這幾段故事中的共同點。這部電影的編排是從短的故事到長的故事，由於短的故事沒有辦法用場多的情節堆疊情緒和描述人物個性，剪接都非常的快，在故事的交代上用上非常非多的鏡頭語言。比如不斷出現在背景的高利貸黑道、掛在牆上的滅火器等等。一切的小細節讓故事的行進非常的流暢，即使是短篇也能很快地切換情緒投入其中。在電影結束後，Colin帶著我們一段一段的剖析導演的巧思，有一些線索不在人物對話中而在背景中：爆破案的黃線、婚禮中新娘的鞋子等等。而最後的謎題，到底導演想說的是什麼？什麼是wild tale？Colin給出了他的解釋，其實答案就在電影名稱裡和片頭的幾個看似無關的畫面。雖然不一定是正解，但我非常的喜歡。電影雖然戲謔，但是但是每一部都緊扣主題。</p><p>這次的電影聚不只在觀影期間精彩，在討論的時候更是興奮。這些分析在網路上也不是那麼容易找到，大部分的人就單純當作黑色幽默喜劇來看，真的是非常的可惜。當然，如果不是Colin我也不會有這樣的機會！現在每個禮拜五都非常的期待。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e2TttdrDMZECVuCIvukTQQ.jpeg" /><figcaption>Engineer of Node</figcaption></figure><p><a href="https://www.instagram.com/node_real_life/">Node伴居本 (@node_real_life) * Instagram photos and videos</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3297a070985" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[禮拜六的生活 - 瑜珈]]></title>
            <link>https://medium.com/@First350/%E7%A6%AE%E6%8B%9C%E5%85%AD%E7%9A%84%E7%94%9F%E6%B4%BB-%E7%91%9C%E7%8F%88-302965c4cb83?source=rss-e01c955eec0------2</link>
            <guid isPermaLink="false">https://medium.com/p/302965c4cb83</guid>
            <dc:creator><![CDATA[First350]]></dc:creator>
            <pubDate>Fri, 05 Jan 2018 08:39:03 GMT</pubDate>
            <atom:updated>2018-01-22T05:19:39.648Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*H59tIFjmL7oZWWC3CZwRdA.jpeg" /></figure><p>連續了4週早上和室友練習瑜珈下午和朋友們分享論文的週末，以前從來沒有這麼精實的週末，且練瑜珈以前想都沒想過。今年因為腳受傷又加上室友Lena的熱情推薦，帶著復健和矯正姿勢的心態開始了每週一次的瑜珈練習。</p><p>第一次的練習讓我覺得最困難的是在平衡，就算根據Lena所說在放鬆的“下犬式”也讓我汗流不止。每個動作都會維持一段時間，可以清楚感受到自己身體肌肉的狀態是緊繃還是放鬆，雖然大腿和小腿實在是太緊繃了，呼吸也沒有辦法很順，但是在伸展結束後是非常舒服的，最後放鬆的Savasana實在是太舒服了！在閉上眼睛的時同時感受身體在伸展之後的放鬆，短短幾分鐘之內幾乎睡著了。瑜珈結束後真的感到前所未有的輕鬆，早上剛起床的煩躁和讀書會前的緊張感完全消失。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tGZeElhEwNebtpAdRdFXWA.jpeg" /></figure><p>之後的練習隨著裴珊的加入也變得更有趣，Lena和裴珊帶的方式也有稍微的不同，但都能感受到練習多年之後對於動作的苛求和練習時的專注力。很可貴的是Lena和裴珊舉辦的這個聚會讓我和Jerry能被她們的熱情感染，而我們的進步也帶給她們能量！當裴珊說看到我們的進步時，我們是非常開心的。</p><p>開始相對是容易，但維持是困難的，不過有一群人一起做的話我相信一點都不困難。</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=302965c4cb83" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[讀書會]]></title>
            <link>https://medium.com/@First350/%E8%AE%80%E6%9B%B8%E6%9C%83-29067720df2a?source=rss-e01c955eec0------2</link>
            <guid isPermaLink="false">https://medium.com/p/29067720df2a</guid>
            <dc:creator><![CDATA[First350]]></dc:creator>
            <pubDate>Mon, 11 Dec 2017 11:57:39 GMT</pubDate>
            <atom:updated>2017-12-11T11:57:39.483Z</atom:updated>
            <content:encoded><![CDATA[<p>回顧前一年研究生的日子，不論是survey paper 或是發想idea都算是單打獨鬥，只聚焦在自己熟悉的領域，感覺總是缺少了一點想像力和熱情。</p><p>今年很幸運遇到一群充滿熱情和相同志趣的夥伴，願意在大家都放鬆的六日，從各地上台北一起讀paper，分享研究經驗</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*honkD4M3PuHVXkfO_Abwpg.jpeg" /></figure><p>其實報paper對研究生來說是再簡單不過的事情，但是得到的回應往往比較單一因為大家的領域和經驗都非常相近。我在-Mike報GAN的時候完全沒有想到會和我的研究接軌，而現在他分享的經驗已經成為我實驗很重要的骨幹了。同樣都是機器學習，有人做醫療影像有人做自然語言處理和增強學習等等，最近這幾種演算法也慢慢整合到各領域了也逐漸逼際實際運用的程度了。在讀書會大家有同樣的目標也對研究有同樣的熱情，我覺得我在每一個人分享和討論的時候都得到很多能量。</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2ILl8TQE4QIuliak41z-rQ.jpeg" /><figcaption>一起做甜點，順便討論自己的作品集</figcaption></figure><p>我們在實體空間相遇，透過面對面的接觸產生更深的連結。我們可以聊工作規劃、如何找實習、國外研討會的經驗甚至自己的熱情。這個禮拜Howard因為平日在台北有參加研討會，剛好有時間來和我們一起煮飯、做甜點。在聚會中也發現Howard的隱藏技能：畫畫！其實透過不同形式的聚會，可以發現大家不同的一面。Howard除了研究所題目外，對於UI/UX設計也接觸很多。在聊產品的開發流程、體驗設計時大家是多麼興奮！不只能在研究上彼此進步，在設計上也可以一起創造些什麼。</p><p>在讀書會討論paper時大家難免嚴肅，對彼此能相互合作的想像也被侷限，但藉由不同的聚會，不管是煮飯還是之前的信籌聚都更加深了彼此之間的連結，。期待我們帶給彼此的不只是專業知識、還有生活上甚至精神上的扶持。</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=29067720df2a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Auth0 with Firebase in React-Native]]></title>
            <link>https://medium.com/@First350/auth0-with-firebase-in-react-native-a528dab9ec59?source=rss-e01c955eec0------2</link>
            <guid isPermaLink="false">https://medium.com/p/a528dab9ec59</guid>
            <category><![CDATA[auth0]]></category>
            <category><![CDATA[react-native]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[First350]]></dc:creator>
            <pubDate>Sun, 21 May 2017 17:09:24 GMT</pubDate>
            <atom:updated>2017-05-21T17:15:30.823Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-eacHI-wtyz5jDM6GElvwg.jpeg" /></figure><p>Authentication 是最基本但是最難以處理的細節，認證不再只有單一的管道，近年的服務幾乎都有passwordless(透過email or SMS 登入)，沒有人喜歡多記一組帳號密碼，密碼不論在安全性上和體驗上都不是最佳的選擇。實際上我們也直接收到來自使用者的回饋建議剔除密碼的機制。當然user experience 永遠是重要的，但是在開發初期沒有規劃的情況下，在工程端就必須要做很多細節的處理了。舉例來說， 如果原本database用的是firebase的服務，本身並不支援passwordless，而重頭做起的話就要從JWT token 開始建構，接著安全性的考量，則要產生一次性token, 設定token 有效期限，如果有重複登入要可以revoke token…etc. 考慮到資源的分配，我們開始survey 第三方提供的authentication.</p><p>Auth0(Auth-zero)是目前看到最完整的解決方案，也可以簡單地整合到firebase, 就流程方面在documentation並沒有非常的詳盡。Auth0 提供authentication API, 這邊因為方便所以先使用官方的react-native-lock, 實際上所有的流程都可以透過api處理，也就是說UI的設計可以完全自己決定，主要的目標：利用auth0的token來換取firebase auth 的 token</p><p>流程：</p><ol><li>Config client addons in auth0 dashboard</li><li>get auth0 token</li><li>use id_token or refresh_token to get firebase token via delegation api endpoint</li><li>use the token to sign in firebase !</li></ol><p>API endpoint: <a href="https://fineighbor.auth0.com/delegation">https://{$YOUR_APP}.auth0.com/delegation</a></p><p>Because delegation function provided in <a href="https://github.com/auth0/react-native-auth0">react-native-auth0</a> currently have some bugs which missed the “https” in his base_url string, plus the error log in his implementation will cause exception “response undefined” due to the above reason. Therefore we have to implementation our own delegation function! (or submit a PR)</p><ol><li>Config addons in auth0 dashboard: Go to Google api console and <strong>choose the corresponding firebase application</strong>, create an service account key.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2MPMMM-xqCDkfD-VNqyIsQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1i_C9KQyTIzVMnIDQoFUWQ.png" /><figcaption>Download the JSON file, will be used later in auth0 config</figcaption></figure><p>Go to Auth0 Client dashboard</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JXHlN2b8g6zXOFRvl-6p8A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cySZ_Nn3uB2tduCMkJ99yQ.png" /><figcaption>Copy the private key including BEGIN PRIVATE KEY and END PRIVATE KEY</figcaption></figure><p>Be sure to copy the private key including BEGIN PRIVATE KEY and END PRIVATE KEY</p><p>2. Get auth0 token (Use official react-native-lock for simplicity)</p><pre>lock.show({<br>      closable: true,<br>    }, (err, profile, token) =&gt; {<br>      if (err) {<br>        console.log(err);<br>        return;<br>      }<br>      // The token will contain id_token and refresh_token</pre><pre>      this.delegation(token)<br>})</pre><p>3. Finally, Get firebase token via delegation api and sign in !</p><pre>// in function delegation</pre><pre>let payload = Object.assign({<br>          &#39;api_type&#39;: &#39;firebase&#39;,<br>          &#39;client_id&#39;: credentials.clientId, //clientId<br>          &#39;id_token&#39;: token.idToken, <br>          &#39;grant_type&#39;: &#39;urn:ietf:params:oauth:grant-type:jwt-bearer&#39;<br>        });</pre><pre>let params = {<br>      method: &#39;POST&#39;,<br>      headers: {<br>        &#39;Accept&#39;: &#39;application/json&#39;,<br>        &#39;Content-Type&#39;: &#39;application/json&#39;,<br>      },<br>      body: JSON.stringify(payload)<br>    }</pre><pre>let res = await fetch(&#39;<a href="https://fineighbor.auth0.com/delegation&#39;">https://${YOUR_APP}.auth0.com/delegation&#39;</a>, params);<br>    let res_json = await res.json()<br>    console.log(res_json);<br>    firebase.auth().signInWithCustomToken(res_json.id_token).catch((error) =&gt; {<br>        console.log(&#39;Failed to sign in Firebase: &#39; + error);<br>    });</pre><pre>console.log(&#39;SUCCESS !&#39;);</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a528dab9ec59" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Time series data with deep learning — (1)]]></title>
            <link>https://medium.com/@First350/time-series-data-with-deep-learning-1-5606b85500ab?source=rss-e01c955eec0------2</link>
            <guid isPermaLink="false">https://medium.com/p/5606b85500ab</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[tensorflow]]></category>
            <dc:creator><![CDATA[First350]]></dc:creator>
            <pubDate>Mon, 03 Apr 2017 13:55:36 GMT</pubDate>
            <atom:updated>2017-04-03T13:55:36.144Z</atom:updated>
            <content:encoded><![CDATA[<p>At first glance, I would say that deep learning for time series data is way too much. The simplest regression or random forest model could handle it. However, I found that the traditional regression model has difficulty when you want to incorporate high dimensional data (i.e. image).</p><p>There are some discussions about using RNN to forecast weather based on images. For start, I want to build a simple model for text data only. That is, input a single value then predict the next value in a certain time window (The most popular dataset can be found as <em>international-airline-passengers in </em>datamarket<em>.com</em>).</p><p>All I have is a sequence of number, { n_1….n_t-1 } as input x, { n2……n_t} as ground truth. Again, for simplicity, we build a simple LSTM model as follows:</p><pre>def model(x, w, b, n_hidden=4):<br>  batch_size = 1<br>  n_steps = 3 <br>  # transform our data shape to [time_step, batch_size, ...]<br>  x = tf.transpose(x, [1, 0, 2])<br>  x = tf.reshape(x, [-1, 1])<br>  x = tf.split(0, n_steps, x)<br>  lstm_cell = rnn_cell.BasicLSTMCell(n_hidden, forget_bias=1.0)<br>  outputs, states = rnn.rnn(lstm_cell, x, dtype=tf.float32)<br>  logits = tf.matmul(outputs[-1], w) + b<br>  return logits</pre><p>The output of rnn.rnn function with be a list of intermediate featuremaps. We take the last one and linear transform to single value by tf.matmul. As for the loss function, we define as follow:</p><pre>pred = model(X, w, b, n_hidden)<br>loss = tf.reduce_sum(tf.pow(pred - Y, 2)) / (n_samples)</pre><p>And that it! The model can fit pretty well after few epochs.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5606b85500ab" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[React-Native 環境變數]]></title>
            <link>https://medium.com/@First350/react-native-%E7%92%B0%E5%A2%83%E8%AE%8A%E6%95%B8-dbba50529463?source=rss-e01c955eec0------2</link>
            <guid isPermaLink="false">https://medium.com/p/dbba50529463</guid>
            <dc:creator><![CDATA[First350]]></dc:creator>
            <pubDate>Fri, 17 Mar 2017 07:04:03 GMT</pubDate>
            <atom:updated>2017-03-17T12:33:52.040Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jxtfuT8t8SMewLUMimGxIw.jpeg" /></figure><p>最近在開發時發現即使有fastlane, 在deploy時仍會遇到許多麻煩．比如在不同環境下，sandbox, staging, deploy 需要configure 到不同的url, 所以在打包的時候還是得手動改原碼中的env. 最理想得狀況是像web一樣只要打包的指令多個參數就可以吃到不同的env file, 然後ios 和 android 可以共用同一份．最完美的解法就是這些command都可以打包成fastlane, 這樣ios, android 原本的流程都可以保持一致．(fastlane的設定可參考<a href="https://blog.fineighbor.com/fastlane-setup-2d93b5be4e7#.pad5kc48k">這裡</a>)</p><h3><strong>IOS</strong></h3><p>選用的套件react-native-config(<a href="https://github.com/luggit/react-native-config">https://github.com/luggit/react-native-config</a>)，詳細的使用方法可以直接到github上面．簡單的說先在root創建.env file 如下</p><pre>WebURL=<a href="http://localhost:3000/">http://localhost:3000</a><br>DataURL=<a href="http://localhost:4000/">http://localhost:4000</a><br>GraphqlURL=<a href="http://localhost:4000/graphql">http://localhost:4000/graphql</a></pre><p>Default react-native-config 會吃到.env file, 現在創建另外.env-staging 和 .env-deploy 來分別app要打包的不同config. 接著根據不同的env在xcode建立不同的Scheme, 如app-staging (在product-&gt;scheme-&gt;Edit Scheme-&gt;Duplicate Scheme 複製一份原本的然後改成可辨識的名稱). 在pre-action時加入command把想要的env file 複製到/tmp/envfile 中</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Pil9d_qPQWQlXP2Tb-ngrw.png" /></figure><p>這樣就可以選擇不同的scheme吃到不同的envfile!</p><p>剩下就是整合到fastlane裡面了，在fastlane/Fastfile 中會定義fastlane command會用的的scheme等各種config，所以只要加入新的描述就可以了</p><pre>desc &quot;upload to appstore using .env-staging envfile&quot;<br>lane :sandbox do<br>  gym(workspace: &quot;./your_work_space&quot;, scheme: &quot;app-staging&quot;)<br>  pilot<br>end</pre><p>之後就可以用fastlane sandbox 的command直接上傳到appstore</p><h3>Android</h3><p>按照react-native-config 中去android/app/build.gradle 中</p><pre>project.ext.envConfigFiles = [<br>    debug: &quot;.env.sandbox&quot;, // custom to anything<br>    release: &quot;.env.deploy&quot;, // custom to anything<br>    anycustombuildlowercase: &quot;.env&quot;,<br>]<br>apply from: project(&#39;:react-native-config&#39;).projectDir.getPath() + &quot;/dotenv.gradle&quot;</pre><p>接著在fastlane/Fastfile 中加入fastlane的ENV設定</p><pre>lane :sandbox do<br>  ENV[&quot;ENVFILE&quot;] = &quot;.env.sandbox&quot; //指定要吃哪一個.env file<br>  gradle(task: &quot;assembleRelease&quot;)<br>  supply ...(略)</pre><p>接下來就fastlane sandbox 就可以上傳到google play 嘍</p><p>Note: 要在react-native 中拿到環境變數如下(Apollo client 為例)</p><pre>import Config from &#39;react-native-config&#39;;</pre><pre>const sagaMiddleware = createSagaMiddleware();<br>const loggerMiddleware = createLogger();</pre><pre>const networkInterface = createNetworkInterface({ uri: Config.GraphqlURL });</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dbba50529463" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[重構 with Graphql Client]]></title>
            <link>https://medium.com/@First350/%E9%87%8D%E6%A7%8B-1-a4d5a657f2a9?source=rss-e01c955eec0------2</link>
            <guid isPermaLink="false">https://medium.com/p/a4d5a657f2a9</guid>
            <category><![CDATA[react-native]]></category>
            <category><![CDATA[graphql]]></category>
            <category><![CDATA[apollo]]></category>
            <dc:creator><![CDATA[First350]]></dc:creator>
            <pubDate>Sat, 04 Mar 2017 15:31:09 GMT</pubDate>
            <atom:updated>2017-03-17T12:34:50.770Z</atom:updated>
            <content:encoded><![CDATA[<p>這次App的重構主要是要對應後端資料庫的改動，以往採用redux-saga的架構已經可以很好的處理side-effect和前後端溝通，不過一直以來我們在資料處理上並沒有太多的優化，比如cache機制和query batching</p><p>所以在後端為Graqhql server 的情況下，自然就會考慮結合redux 和 graphql client. 一般在選擇上有 Relay 和 Apollo 為大宗，經過survey下來，其實兩者提供的功能並沒有差太多，Relay有Facebook的支援，不過Apollo在架構上和直覺上和redux是同一件的事情．Relay在學習上就稍微困難了一些．所以為了保持原本redux的開發模式加上Apollo較易學習的優點上，我們採用apollo-client為重構的重點．</p><p>我認為Apollo的好處就是可以很簡單從一個component看到背後對應的資料，用High-Order-Component 組出重複利用性很高的組件。缺點就是component可能會多了些處理資料的邏輯，這篇主要分享和紀錄一下使用apollo-client query 的想法和經驗</p><p>Apollo可以簡單的和redux store做連結，還可以定義傳送request的network-interface並帶入header token，這樣做的好處就是我可以直接connect到元件去取得apollo query 或 mutation的結果，比如：</p><pre>// For apollo client combine with redux store<br>const networkInterface = createNetworkInterface({ uri: ENV.GraphqlURL });</pre><pre>networkInterface.use([{<br>  async applyMiddleware(req, next) {<br>    if (!req.options.headers) {<br>      req.options.headers = {}; <br>    }<br>    let user = await storage.getUser();<br>    req.options.headers[&#39;token&#39;] = user.token<br>    next();<br>  }<br>}]);</pre><pre>const client = new ApolloClient({<br>   networkInterface: networkInterface,<br>});</pre><pre>// add apollo client into your redux store</pre><pre>const store = createStore(<br>  combineReducers({<br>    nav: (state, action) =&gt; (<br>      // for react-navigation<br>      RootNav.router.getStateForAction(action, state)<br>    ),<br>    apollo: client.reducer(),<br>    ...reducers<br>  }),<br>  compose(<br>    applyMiddleware(<br>      sagaMiddleware, <br>      client.middleware()<br>    ),<br>  ),<br>);</pre><p>Query 比較特別一點，Apollo在設計的時候會在元件mount時自動發出，雖然是個貼心的設計畢竟會結合query的元件就是要顯示data回傳結果的，但是當user在還沒有被驗證時我們並不希望server受到這種無謂的干擾(必定會被reject)，所以在query 的 option中通常會加上skip的選項：</p><pre>const ComponentWithData = graphql(getData, {<br>  props: ({ ownProps, data: { loading, data, refetch } }) =&gt; ({<br>    // remap query format for props<br>    packages: {<br>      data,<br>      loading,<br>      refetch,<br>    }<br>  }),<br>  skip: (ownProps) =&gt; !ownProps.user.token,<br>})(Component);</pre><p>再來就會想到既然資料抓回來了，我還要再加上些後續處理的邏輯怎麼辦(比如儲存到localStorage)，在這樣的情況中目前直接能拿到資料是透過component的props，要在component 直接加上這邊的邏輯不是很理想．一般在redux下可能會透過sagas 或是 reducer 來解決．在Apollo裡面也是一樣，可以直接access到apollo的reducer:</p><pre>const ComponentWithData = graphql(getData, {<br>  props({ data }) {<br>    // ...<br>  },<br>  options({ params }) {<br>    return {<br>      reducer: (previousResult, action, variables) =&gt; {<br>        if (action.type === &#39;APOLLO_QUERY_RESULT&#39; <br>        &amp;&amp; action.operationName === &#39;getData&#39;){<br>          // update your query etc...<br>          // store your data...<br>        } <br>        return previousResult;<br>      },<br>    };<br>  },<br>})(Component);</pre><p>如果元件只包含呈現query資料或是簡單的mutation，用Apollo做會非常的快而且清楚(不煩惱query batching 和 cache 等等的問題)，不過當需要很多額外邏輯時可能要結合原始的redux-saga會比較好做，如處理user登入驗證等等．關於Apollo目前還有發現很多有趣且好用的地方，在開發上好上手社群也夠活絡，期待日後開發上還能結合更多Apollo的功能．</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a4d5a657f2a9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Back to basics]]></title>
            <link>https://medium.com/@First350/back-to-basics-6fcaf2e47843?source=rss-e01c955eec0------2</link>
            <guid isPermaLink="false">https://medium.com/p/6fcaf2e47843</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[deep-learning]]></category>
            <dc:creator><![CDATA[First350]]></dc:creator>
            <pubDate>Fri, 24 Feb 2017 01:54:02 GMT</pubDate>
            <atom:updated>2017-02-24T11:40:42.275Z</atom:updated>
            <content:encoded><![CDATA[<p>I am not an experienced researcher in deep learning, so in the post I just record my thoughts and findings through the years, making sure I am not doing the same mistakes again.</p><p>I build my first model in Theano 2 years ago. Back then I was doing Matrix Factorization algorithm and build recommendation system. The theory behind this are massive and there are many detail to cope with. Build a simple MF model from scratch that work for real-world cases is so difficult. Even with those well-known library such lib-MF I still cannot manage to produce a decent model. Those tricks in online-learning algorithm, adjust time window, dealing with concept shift, cold start problem…etc. Missing any of those details could led to bad performance for recommendation system. I was so frustrated at that time.</p><p>After the project is finished, a new course appears on the school website and caused a lot of discussion called “deep learning”. I was startled by the simplicity and performance of DNN. For recommendation system I was simply doing some text data which is human readable. In the course I was dealing with acoustic data and aimed to build a workable voice recognition model. At the end of the semester, almost every student accomplished the task.</p><p>Those complex data such as images, video, human language and speech which is hard to dealing with are become simply with the help of deep learning. We can compose some simple structure such as Convolution, Pooling layers and make some reasonable assumption and physical meaning. The network just worked. All I have to do is switching those components and parameters to tune the network for my research dataset. (Of course with the framework such as Tensorflow, keras, caffe…etc). Everything seems to be easy and everyone can do deep learning.</p><p>However, after more digging in this field, I found myself unable to figure out why the model was unstable. Is the initialization unstable or learning rate was messed up ? I can just do try and error because of the lack of fundamental knowledge. I wasn’t pay much of attention in the proof behind those network basic components such as activation function and momentum. Things are a lot complex and I should always notice the details.</p><p>What I learned from those days is that no matter how the technology makes things easy I should always back to basics. Never neglect details even though nobody pays attention and think it is simple or trivial. Recently a great paper and great post are discussing a paper called <strong>Wasserstein GAN. </strong>The analysis of Generative Adversarial Networks is very thorough. The author analyzed every detailed of the GAN network and seemed to solve the training issue. I wasn’t fully understand the analysis but I think the spirit of it (analyze every detail and fundamental theory ) this very admirable.</p><p>I think there is no easy way to accomplish great things and nobody can learn things in 3-minutes or in a single course (According to some advertisement….).</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6fcaf2e47843" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>