<?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 Iftekher Mamun on Medium]]></title>
        <description><![CDATA[Stories by Iftekher Mamun on Medium]]></description>
        <link>https://medium.com/@imamun?source=rss-41404f6cc939------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*qfwHHjxB5WV0jq7CxJAN7g.jpeg</url>
            <title>Stories by Iftekher Mamun on Medium</title>
            <link>https://medium.com/@imamun?source=rss-41404f6cc939------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 04:17:18 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@imamun/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[Hello, It’s Been a While]]></title>
            <link>https://medium.com/@imamun/hello-its-been-a-while-4587183a0de2?source=rss-41404f6cc939------2</link>
            <guid isPermaLink="false">https://medium.com/p/4587183a0de2</guid>
            <category><![CDATA[journey]]></category>
            <category><![CDATA[recruiting]]></category>
            <category><![CDATA[cancer]]></category>
            <category><![CDATA[life-lessons]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Iftekher Mamun]]></dc:creator>
            <pubDate>Sat, 04 Dec 2021 22:30:38 GMT</pubDate>
            <atom:updated>2021-12-04T22:30:38.122Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BzLvh7TZW6fuPqwrBkGohg.png" /><figcaption><a href="https://www.google.com/url?sa=i&amp;url=https%3A%2F%2Fwww.shasiesworld.com%2F2020%2F06%2Fits-been-awhile.html&amp;psig=AOvVaw1nwoH8BqYnlf7qwSMIpDBL&amp;ust=1638743328288000&amp;source=images&amp;cd=vfe&amp;ved=0CAsQjRxqFwoTCIj5-eiYy_QCFQAAAAAdAAAAABAD">Source</a></figcaption></figure><p>Hi Medium. It has been a while since I last posted anything in here. As a matter of fact, it is actually close to 2 years since my last major publication. Well, these past two years have been eventful, to say the least. I am here to write about a few of those events (or a lot) to fill in the gap and to act as a reminder to myself.</p><p>The last time we interacted, Covid-19 was a new thing. Remember those days? <em>It will be over soon, it won’t reach US etc. etc.? </em>When interacting with people face to face was a positive and online networking was frowned upon? It feels like a lifetime ago. Well, for me perhaps it was. Shortly after finishing and publishing my last project on <a href="https://towardsdatascience.com/molecular-properties-a-journey-through-multiple-linear-regression-1a1043c7de25">biological and molecular charges</a>, a bioinformatics company reached out to me asking if I was interested in working with them as one of their data engineer in their startup. The only catch is that they are based in South Korea and will not do remote work. In 2019, coronoavirus was taking quite a toll in Asia and by the time I agree to work for them, covid was also raging quite hard in the US. With strict travel restrictions, I had to verify my work authorization to the US and Korean Embassy by getting multiple certification, reference letter and my education diploma notirized and apostled. The copies had to be sent to South Korea by mail. This start-up process itself took about 4 months. At this point in time, we are in 2020, around May.</p><p>Then I spent another month getting medical clearance and multiple covid test. By the time I landed in Korea, it was already June of 2020. At that point- and still now I believe- you have to go through mandatory quarantine regarldess of how many times you tested negative for coronavirus. After 2 weeks alone in a small room with not much interactions with the outside world, one can imagine what my mental state might have been like. But I was excited. Now I get to work as a data engineer and help discover new drug pathway using machine learning. But before I can start, I had to go through another round of medical checkup. By the time it was my first day, I was already finishing up the first week of July.</p><p>I worked as a data engineer from July to December. I learned how to operate on Google Cloud platform. I learned about data version control, how to operate on ubuntu and unix based operating system. I also learned to properly set up docker environment and how it can pull terabytes of data in batches using pipelines. I was able to contribute to the creation and maintenance of the pipeline. Using what the company and the people showed me, I was able to create a pipeline that executes commands from your terminal, connect to the Google platform, instantiate a storage, pull raw data, clean and place them in their appropriate location. After creating a temporary save file, the cleaned data would be the new input for a simulation model that was based on Grammar Variational Auto Encoder. In the end, my pipeline was able to create thousands of novel and valid drug molecule from a single input. It was great working on it and I wanted to work on it longer. After all, it was a lot of trouble for both the company and myself to travel to South Korea, only to work for less than 6 months.</p><p>Unfortunately, my journey had to come to an end. The medical tests came back, and on December 8th, a year ago, I was told that my cancer had came back for the third time. To be honest, I was not as bummed out as one would expect, as at that time I was also dealing with depression and loneliness. The people I worked with were great but not being able to speak the language put a damper on how well I can make friends. Anyway, after confirming with the doctor, I let the people in my company know of my situation. They immediately told me that I should return to the US for treatment. Unfortunately due to how the work visa was set up, I would not be able to retain my employment and they gracefully terminated my contract. They even helped clean up my apartment as I had to leave on a rush. On my birthday, December 16th, I returned to NY, USA to go at it with cancer one more time.</p><p>The test results in the US showed that the cancer has already spread throughout my whole body. At this point, I lost over 15 lbs and would almost always get terrible pain and high night fever. There were many complications in the start of the journey given 2021 just started and covid is still a daily nightmare. After discussing with the doctors, we decided on a two step treatment plan. First is a simple chemo therapy to see how the body response to the treatment. Then a rigorous chemo therapy treatment paired with stem cell transplant to wipe out my immune systems and restarting it, effectively giving me a brand new immune system. The first set of chemotherapy were actually pretty easy. It took 2 months or so and I only had to be hospitalized overnight once. That may sound scary, but those that have been through chemo and had adverse effect knows it can be much worse, as I will show soon.</p><p>The process of the stem cell transplant was both new and complicated to me. My procedure was <a href="https://www.mayoclinic.org/tests-procedures/autologous-stem-cell-transplant/pyc-20384859">autologus stem cell transplant</a>, where they collect your own stem cell and input that after a system clean. First they had to give me <a href="https://www.neupogen.com/">neopogen injections</a> to produce more stem cells. This is where my first problem occured. After 3 days of consecutive injection, my body could not handle the extra anti-bodies being created and crashed. I spent a week with an oxygen mask in an ICU at NYU Langone. On the bright side, I had a terrific view. Due to this, my transplant was pushed back by 2 weeks as I had to recover to optimal health… in relative to my current condition. Two weeks later, I was admitted again for the actual transplant. In between, I had<a href="https://www.saintlukeskc.org/health-library/central-line-central-venous-access-device"> two central line</a> put in, on two sides of my chest. One internal and one external (peripheral)- and the external one definately made everyday life more difficult than it already was. The transplant process took one week and I spent the next two weeks in agonizing pain in the hospital as my immune system slowly recovered. Then once discharged, I had to rest for another month at home, just slowly recovering.</p><p>At this point, I decided to start looking for job, at least to keep my mind a bit busy. But soon I found out that I am still not at optimal condition. I started physical therapy at the recommendation of my oncologist. Next to the stem cell transplant, physical therapy is the second hardest obstacle I went through in 2021. 4 months of intense physical training to build up stamina, muscle and endurance. In mid October of 2021, I was finally cleared to resume normal (as normal as it can get) life.</p><p>At the point of writing and publishing this, it is December. So what have I been doing during this time? Mostly interviewing like crazy, and getting rejected to someone with better talent. I also saw that while I understood the theory of coding, I myself am not a great coder. I can look at a code and explain what it does to someone, and I can understand how much someone understands programming. I can help teach someone how to code efficiently or explain complex matters in simpler terms. But for me to code, that is where my weakness is. I noticed it from when I code to learn, to relax or for professional purposes.</p><p>I realized that while I do like programming, my ability to connect and understand people is where I excel at. I want to use my experience as a programmer and as an instructor to help people land the career they want and the company to be happy with their newest recruit. I have never gave up while battling cancer, and what kept me going were the people around me. I now want to be one of those people that helps someone else not give up. That is why I decided to go into recruitment; as a technical recruiter, with my background in neuroscience, programming and people skills, I believe I can help you get closer to your goal.</p><p>It has been a tough journey, but I refuse to give up anytime soon. I will try to write more on medium, wheter they are about projects I am working on, frequest programming questions my students always asks or just something I find interesting or funny. I will try my best to hold myself accountable but if I forget, I hope you will. Thank you for reading and have a good day.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4587183a0de2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Molecular Properties: A Journey through Multiple Linear Regression]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/data-science/molecular-properties-a-journey-through-multiple-linear-regression-1a1043c7de25?source=rss-41404f6cc939------2"><img src="https://cdn-images-1.medium.com/max/600/1*q2zDtg9EHHL4fHUkrnc6fQ.png" width="600"></a></p><p class="medium-feed-snippet">This is my version of the Kaggle competition of Molecular Properties. The goal is to predict the scalar coupling constant using the&#x2026;</p><p class="medium-feed-link"><a href="https://medium.com/data-science/molecular-properties-a-journey-through-multiple-linear-regression-1a1043c7de25?source=rss-41404f6cc939------2">Continue reading on TDS Archive »</a></p></div>]]></description>
            <link>https://medium.com/data-science/molecular-properties-a-journey-through-multiple-linear-regression-1a1043c7de25?source=rss-41404f6cc939------2</link>
            <guid isPermaLink="false">https://medium.com/p/1a1043c7de25</guid>
            <category><![CDATA[towards-data-science]]></category>
            <category><![CDATA[tableau]]></category>
            <category><![CDATA[kaggle]]></category>
            <category><![CDATA[molecular-biology]]></category>
            <category><![CDATA[linear-regression]]></category>
            <dc:creator><![CDATA[Iftekher Mamun]]></dc:creator>
            <pubDate>Wed, 18 Dec 2019 18:05:02 GMT</pubDate>
            <atom:updated>2019-12-18T18:41:23.233Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[SAS Proc Functions]]></title>
            <link>https://medium.com/@imamun/sas-proc-functions-6fe6f6557afe?source=rss-41404f6cc939------2</link>
            <guid isPermaLink="false">https://medium.com/p/6fe6f6557afe</guid>
            <dc:creator><![CDATA[Iftekher Mamun]]></dc:creator>
            <pubDate>Thu, 26 Sep 2019 19:32:52 GMT</pubDate>
            <atom:updated>2019-09-26T19:32:52.959Z</atom:updated>
            <content:encoded><![CDATA[<p>Here, I will simply post list of procedure functions for SAS and how to implement them.</p><ol><li>proc print prints the data observation</li><li>proc contents displays the metadata of the dataset</li><li>who created, header, variables, etc</li><li>proc forms allows you to custom make tables</li><li>proc form data= sashelp.class across=5;</li><li>lin1 name;</li><li>line2 sex;</li><li>line3 height;</li><li>run;</li><li>the line variables displays the variables and across will display numbers or observation</li><li>proc chart allows you to create line oriented graph tools that includes varieties of charts and graphs</li><li>proc chart data= sashelp.cars;</li><li>pie origin; #describe what type of chart you want</li><li>vbar for vertical bar graph, hbar for horizontal bar etc</li><li>run;</li><li>proc gchart creates with color</li><li>add pie3d origin (or whatever with 3d) to create 3D charts</li><li>proc freq allows to produce how many times something occurs</li><li>it produces a one-way frequency table on a specific variable</li><li>proc freq data= sashelp.cars;</li><li>run ; #this will calculate freq on every variable and cross variable possible</li><li>generally don’t want all variables</li><li>proc freq data= sashelp.cars;</li><li>tables make; get freq of the make column (manufacture)</li><li>to cross tabulate: tables origin*make</li><li>can be done with multiple columns/variables as needed but this makes it more complex to compute</li><li>run;</li><li>proc means is for descriptive stats</li><li>avg, mode, median, minimum, maximum, std dev,</li><li>proc means data= sashelp.class;</li><li>class age; #will run stats on the variable mentioned</li><li>run;</li><li>proc summary gives a summary of data</li><li>must use print after mention of data to generate the output</li><li>it will give you observation of dataset</li><li>proc summary data= sashelp.class print;</li><li>class age;</li><li>run;</li><li>proc univariate provides a larger statistics than proc mean</li><li>proc univariate data= sashelp.cars;</li><li>run;</li><li>basically runs inferential/ quantitative statistics</li><li>proc export helps export data from SAS to a different form</li><li>proc export data=sashelp.cars;</li><li>outfile= “file location name with the .file type”</li><li>dbms= csv; #file type</li><li>run;</li><li>if you use the replace option at the dbms part, it will replace old file with new one</li><li>proc import helps import files into sas</li><li>proc import: importing different types of datafile into SAS</li><li>proc import datafile= ‘location of data/name.filetype’</li><li>out= name dbms= dlm replace;</li><li>delimiter= ‘whatever the delimiter is;</li><li>run;</li><li>proc copy: copy of dataset from one location to another</li><li>create a new libname</li><li>proc copy in= file libary location</li><li>out= where you want it to be;</li><li>select (the database);</li><li>run;</li><li>proc append: adding new information to database</li><li>just pull the new added data from source and append it</li><li>proc append base= class (old databse where new data will be added)</li><li>data= sashelp.class; (the new database from which the data will be taken)</li><li>run;</li><li>proc datasets have multiple functions. it is like the master of all proc</li><li>proc format allows you to change some values of the dataset pulled. it does not change the intrinsic values but presents it in a more understandable way</li><li><strong>data</strong> nm;</li><li>input emp_id emp_name :$10. jobcat :$5. rating;</li><li>datalines;</li><li>123 prasad one 2</li><li>135 Anu two 1</li><li>156 kim one 3;</li><li><strong>run</strong>;</li><li><strong>proc</strong> <strong>format</strong>;</li><li>value $jc ‘one’=’Highlevel</li><li>‘two’=’mid level’;</li><li>value rate <strong>0</strong>=”terrible”</li><li><strong>1</strong>=”poor”</li><li><strong>2</strong>=”fair”</li><li><strong>3</strong>=”good”;</li><li><strong>run</strong>;</li><li><strong>proc</strong> <strong>print</strong> data=nm;<strong>run</strong>;</li><li><strong>proc</strong> <strong>print</strong> data=nm;</li><li>format jobcat $jc. rating rate.;</li><li><strong>run</strong>;</li><li>proc rank: find rank of objects within dataset. allows for ascending or descending order</li><li>proc compare: to compare Nd find difference between dataset</li><li>proc compare base= original data</li><li>compare= new data comparing to</li><li>id whichever object you are comparing it to</li><li>run;</li><li>proc pwencode (password encode) to encode password</li><li>proc pwencode in= ‘actual password’ method= sasenc; run;</li></ol><p>For more information look into SAS help and type proc</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6fe6f6557afe" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Picking the Proper MLA for Linear Regression]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/data-science/picking-the-proper-mla-for-linear-regression-4221ea5a8f2e?source=rss-41404f6cc939------2"><img src="https://cdn-images-1.medium.com/max/600/1*sUSf5saAHsMQQ5ouVJpM-A.png" width="600"></a></p><p class="medium-feed-snippet">Decision Tree Succeeds where Ordinary Least Squared Failed</p><p class="medium-feed-link"><a href="https://medium.com/data-science/picking-the-proper-mla-for-linear-regression-4221ea5a8f2e?source=rss-41404f6cc939------2">Continue reading on TDS Archive »</a></p></div>]]></description>
            <link>https://medium.com/data-science/picking-the-proper-mla-for-linear-regression-4221ea5a8f2e?source=rss-41404f6cc939------2</link>
            <guid isPermaLink="false">https://medium.com/p/4221ea5a8f2e</guid>
            <category><![CDATA[linear-regression]]></category>
            <category><![CDATA[towards-data-science]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[features]]></category>
            <category><![CDATA[decision-tree-regressor]]></category>
            <dc:creator><![CDATA[Iftekher Mamun]]></dc:creator>
            <pubDate>Sun, 22 Sep 2019 01:44:32 GMT</pubDate>
            <atom:updated>2019-09-22T03:22:56.121Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Linear Regression of Selected Features]]></title>
            <link>https://medium.com/analytics-vidhya/linear-regression-of-selected-features-132cc6c4b600?source=rss-41404f6cc939------2</link>
            <guid isPermaLink="false">https://medium.com/p/132cc6c4b600</guid>
            <category><![CDATA[rmse]]></category>
            <category><![CDATA[linear-regression]]></category>
            <category><![CDATA[towards-data-science]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[feature-selection]]></category>
            <dc:creator><![CDATA[Iftekher Mamun]]></dc:creator>
            <pubDate>Fri, 13 Sep 2019 15:39:49 GMT</pubDate>
            <atom:updated>2019-09-13T15:39:49.662Z</atom:updated>
            <content:encoded><![CDATA[<h4>Part 2 of LGBM. Taking the important features and running linear regression model through them</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sJG6Z3ndkvTYcxivjy5zEQ.png" /></figure><p>My earlier post on LGBM models and using it to extract important features can be found <a href="https://medium.com/@imamun/lgbm-and-feature-extraction-ae87fe83ea77">here</a>. In this post, I will take those important features and run them through linear regression, do further analysis and identify the relationship between these features and the target variable.</p><p>I decided to work with the top 14 features from the feature importance section. Using seaborn correlation map, I extracted this heatmap</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/786/1*eUVHKqL5Z_yjTZCCxjTRrw.png" /><figcaption>sns.heatmap(features.corr(), center=0);</figcaption></figure><p>Here we see that fc, pso, sd and dso are correlated with each other positively but negatively with the rest. And many of these features have no correlation at all (all the black spots). To see the quantification of this, I ran a simple Ordinary Least Squared (OLS) model on these features with the target:</p><pre>X= feature_train<br>y= target_train<br>model= sm.OLS(y, X).fit()<br>predictions= model.predict(X)<br>model.summary()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/906/1*noYIPvAdhyr_HtwkoeLFDg.png" /><figcaption>Just focus on the t-test and the p value</figcaption></figure><p>From here we see that there is a division. Quite a bit of these features have no significant impact on the target variable (scalar coupling constant). While the first four variables have a high T score value as well as a p-value that is less than 0.05. This further confirms the correlation heat map. Even within the important features, some are playing a bigger significant role than the rest.</p><p>So I isolated the features fc, pso, sd, and dso into a separate test and ran them against the target</p><pre>X= feature_train[[&#39;fc&#39;, &#39;pso&#39;, &#39;sd&#39;, &#39;dso&#39;]]<br>y= target_train<br>model= sm.OLS(y, X).fit()<br>predictions= model.predict(X)<br>model.summary()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/862/1*u30iXhBlbcjY9LNRhSSqWQ.png" /><figcaption>Now see that the correlation did not change (R-squared)</figcaption></figure><p>Then I isolated the rest of the features and ran them against the target variable:</p><pre>X= feature_train[[&#39;mulliken_charge_atom1&#39;, &#39;YY&#39;, &#39;XX_atom1&#39;, &#39;XX&#39;, &#39;ZZ&#39;, &#39;YY_atom1&#39;, &#39;mulliken_charge&#39;, <br>                  &#39;potential_energy&#39;, &#39;ZZ_atom1&#39;, &#39;Z&#39;]]<br>y= target_train<br>model= sm.OLS(y, X).fit()<br>predictions= model.predict(X)<br>model.summary()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/850/1*CRf0Xvtjz5rvC0eZj8Razg.png" /><figcaption>Observe the huge change in R-squared</figcaption></figure><p>This showed that these features are not as important to determine the target. The next step would be to run through a Root Mean Squared Error (RMSE) test to see if all these features from LGBM can actually predict well:</p><pre>from sklearn.linear_model import LinearRegression<br>linreg= LinearRegression()<br>model= linreg.fit(feature_train, target_train)</pre><pre>y_hat_train= linreg.predict(feature_train)<br>y_hat_test= linreg.predict(feature_test)</pre><pre>train_residuals = y_hat_train - target_train<br>test_residuals = y_hat_test - target_test</pre><pre>print(len(feature_train), len(target_train), len(feature_test), len(target_test))</pre><pre>419233 419233 46582 46582 #just to make sure all the dimensions are correct</pre><p>Now to create the actual RMSE calculation. Generally, the smaller the number, the better your algorithm is</p><pre><br>mse_train = np.sum((target_train - y_hat_train)**2)/len(target_train)<br>mse_test = np.sum((target_test - y_hat_test)**2) / len(target_test)<br>rmse_train=np.sqrt(mse_train)<br>rmse_test=np.sqrt(mse_test)<br>print(&quot;Train MSE&quot;, mse_train)<br>print(&quot;Test MSE&quot;, mse_test)<br>print(&quot;Train RMSE&quot;, rmse_train)<br>print(&quot;Test RMSE&quot;, rmse_test)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*UgNliPmqd899Szx6I3RNkA.png" /><figcaption>Both shows rather small root mean square error showing data is valid. However, this is including all the selected features, not the main ones determined from above ols</figcaption></figure><p>I liked these numbers, despite what my OLS model showed earlier. So I decided to check for this by testing it against an unknown test set and see how well it predicts:</p><pre>y= y_hat_train - target_train<br>sns.residplot(target_train, y_hat_train, data=feature_target)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/690/1*daC48ugYaLuTTFFq20-K4A.png" /><figcaption>Shows huge outliers with some variables. Now to test it with the ols determined significant features</figcaption></figure><p>Now we know that there are some heavy outliers presents and based on our OLS summary I can guess that this is due to the features that are not contributing enough. I will test for this model again but only use the features from the OLS model.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=132cc6c4b600" width="1" height="1" alt=""><hr><p><a href="https://medium.com/analytics-vidhya/linear-regression-of-selected-features-132cc6c4b600">Linear Regression of Selected Features</a> was originally published in <a href="https://medium.com/analytics-vidhya">Analytics Vidhya</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Quick Code Into to SAS]]></title>
            <link>https://medium.com/@imamun/a-quick-code-into-to-sas-d25eca221de6?source=rss-41404f6cc939------2</link>
            <guid isPermaLink="false">https://medium.com/p/d25eca221de6</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[statistical-analysis]]></category>
            <category><![CDATA[beginner-coding]]></category>
            <category><![CDATA[sass]]></category>
            <dc:creator><![CDATA[Iftekher Mamun]]></dc:creator>
            <pubDate>Sat, 07 Sep 2019 21:36:57 GMT</pubDate>
            <atom:updated>2019-09-07T21:36:57.894Z</atom:updated>
            <content:encoded><![CDATA[<h4>A simple code example SAS server</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/928/1*SyGQd4xW1MT2xIiU_9gJfw.png" /><figcaption>Starting SAS Machine on a Server</figcaption></figure><p>After you have finished installing SAS and have the machine running, let’s follow some basic code on how to program in SAS and what it looks like.</p><p>We will follow a simple flight gate departure dataset. First we will create the dataset with the following:</p><pre>data departures;</pre><p>Then we will increase the limit of character count to a certain number:</p><pre>input USGate $15.;</pre><p>Then we will insert the actual data into the dataset with this:</p><pre>datalines;</pre><p>That is telling SAS that we are going to import information regarding the dataset, which are these:</p><pre>San Francisco<br>Honolulu<br>New York<br>; /* this signifies the end of the statement, rather input for dataline*/<br>run;</pre><p>Finally, we run the dataset with this:</p><pre>proc print;<br>run;</pre><p>Lets run those and look at the log and the result output:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aCy4vLmNF65e3g0W9SWpzA.png" /><figcaption>The log shows if it ran properly or not</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/482/1*3GyGccjA4zJ9gUL1hP0mxw.png" /><figcaption>This is our output table from the dataset</figcaption></figure><p>Now lets create a new dataset:</p><pre>data aircode;</pre><p>And now input information from the first dataset with set:</p><pre>set departures;</pre><p>Then we increase the character count a bit more, just in case as we are going to input more information:</p><pre>length airport $20.;</pre><p>Finally, we will add more data, but now more like an if else statement function. This way, SAS can incorporate the dataset from earlier and push it through the function we are about to run:</p><pre>if USGate = &#39;San Francisco&#39; then Airport = &#39;SFO&#39;; <br>else if USGate = &#39;Honolulu&#39; then Airport = &#39;HNL&#39;; <br>else if USGate = &#39;New York&#39; then Airport = &#39;JFK or LGA&#39;; <br>run;</pre><p>Finally, lets run and look at the log and output again:</p><pre>proc print;<br>run;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UloCC0rT6S-OrVnZmXeEmQ.png" /><figcaption>First the log, showing no error again</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WhfU9u0nRi4_9Y0QK1M5LQ.png" /><figcaption>Notice that this table has an extra column with additional information.</figcaption></figure><p>And that is it. SAS is relatively simple to use and you can see the similarity between other programming language. I am familiar with MySQL and Python so it was relatively easy for me to figure out SAS. Thanks for reading.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d25eca221de6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What, Why, How: SAS]]></title>
            <link>https://medium.com/@imamun/what-why-how-sas-4c8170c5bb7e?source=rss-41404f6cc939------2</link>
            <guid isPermaLink="false">https://medium.com/p/4c8170c5bb7e</guid>
            <category><![CDATA[statistics]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[sass]]></category>
            <category><![CDATA[intro]]></category>
            <category><![CDATA[statistical-analysis-soft]]></category>
            <dc:creator><![CDATA[Iftekher Mamun]]></dc:creator>
            <pubDate>Sat, 31 Aug 2019 15:45:17 GMT</pubDate>
            <atom:updated>2019-08-31T15:45:17.758Z</atom:updated>
            <content:encoded><![CDATA[<h4>A short description of Statistical Analytical System</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yQdBZEVkYVdbzxzkI81yZg.png" /><figcaption><a href="https://zdnet2.cbsistatic.com/hub/i/r/2018/03/02/5f2f7b51-ad05-4577-a0a2-8d3cd67f3e58/resize/1200x675/a6b62d4ee07c13d221d0b44279ad7f76/sas-logo.png">Source</a></figcaption></figure><p>Statistical Analytical System, often referred to as SAS is a software developed by<a href="https://www.sas.com/en_us/home.html"> SAS institute for advanced analytics</a>. It is a great tool, similar to how SQL works that helps gather data from different sources and gives an output results of those data. We can use SAS for ETL (Extrapolate, Transform, Load) purposes as well as reporting on databases.</p><p>If you don’t have SAS installed, click <a href="https://www.sas.com/en_us/software/university-edition/download-software.html">here</a> and select your operating system. Then follow the very intuitive video guide and you will have a downloadable SAS vm in your computer.</p><p>SAS is syntax insensitive so you can write your codes in a variety of manner. It is also very versatile can be used in virtually any setting to access, manipulate, manage, store, analyze and report on data. SAS connects to any relational database as well as multiple types of files such as csv</p><p>There are two main types of variable assignment for SAS. The first is numeric, and all variables are by default numeric unless otherwise mentioned. The second is character, which contains strings as well as special characters. To separate a variable between a numeric and a character, the inputs should be ‘ ’ around them. There are other ways to identify a character but that is the most common one. The second most common way is to put $ symbol right after the input of the variable. This will classify it as a character type instead of numeric type:</p><pre>Numeric:<br>x= 8;<br>Character:<br>X=&#39;8&#39;;  /* OR X= 8$; */</pre><p>The /* */ means that SAS will not read anything in between as codes. This is how to add comments on SAS. In addition, you can also just do * to start and end with ; for your commenting. But all SAS statements must end with ;</p><p>To name a database, it either has to start with a character letter or _. For creating database name, it will be treated as a character type instead of numeric. If it does not contain a letter or _, the database will not be accepted. However, like in python special variables, we cannot use the following names in SAS: names _N_, Error_, FILE_, INFILE_, _MSG_, _IORC_, and _CMD_. They are reserved for the variables that are generated automatically for a Data step so user can’t create variables with these names.</p><p>To initiate a dataset:</p><pre>data demo: /* demo is the name of the dataset*/</pre><pre>x= 8 /*numeric*/<br>b= Eight $ /*character*/<br>run;</pre><pre>proc print; /*shows the results in output table*/<br>run;</pre><pre>proc print content; /*shows the metadata of the table*/<br>run;</pre><p>To run a dataset is generally just that simple. However, remember that only one information can be stored at a time in a table for a single variable. For example:</p><pre>data demo: /* demo is the name of the dataset*/</pre><pre>x= 8 /*numeric*/<br>x= Eight $ /*character*/<br>run;</pre><pre>proc print; /*shows the results in output table*/<br>run;</pre><pre>proc print content; /*shows the metadata of the table*/<br>run;</pre><p>The output of <em>proc print;</em> will only show x=8 (the numeric value) instead of x= ‘Eight’ (the character value). SAS reads information from top to bottom and the first value it reads is recorded.</p><p>That is all for now. I will try to update with more information and examples in the future, but this is a short look into how SAS works.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4c8170c5bb7e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Installing a Local MySQL Server]]></title>
            <link>https://medium.com/@imamun/installing-a-local-mysql-server-bdfb0af88666?source=rss-41404f6cc939------2</link>
            <guid isPermaLink="false">https://medium.com/p/bdfb0af88666</guid>
            <category><![CDATA[mysql-server]]></category>
            <category><![CDATA[installation]]></category>
            <category><![CDATA[mysql]]></category>
            <category><![CDATA[database]]></category>
            <category><![CDATA[mysql-workbench]]></category>
            <dc:creator><![CDATA[Iftekher Mamun]]></dc:creator>
            <pubDate>Mon, 26 Aug 2019 02:07:17 GMT</pubDate>
            <atom:updated>2019-08-26T02:10:19.133Z</atom:updated>
            <content:encoded><![CDATA[<h4>Installing and setting up a local MySQL server for use, simply because DB SQLite is too slow</h4><p>The only thing I knew about SQL was just writing statements. Given that most of my practices came from hackerrank which already have an sql server built in, I did not really give much thought on setting one up on my own. I installed the basic DB SQLite a while back and I thought that was enough.</p><p>I found out how wrong I was when I was given a dataset with over 24 thousands rows. At that point I realize how slow DB SQLite actually was. So while my patience was running low, I started to look into SQL server I can set up for free. Unfortunately, that was also relatively tough. There are so many different kinds. Which one is right for me? After some thinking I went with the SQL language I was most familiar with: MySQL. After some googling and youtubing, I finally came across a video that helped me install the server. Here is the youtube video for those interested: <a href="https://www.youtube.com/watch?v=UcpHkYfWarM">Installing MySQL Workbench</a>. However, there was some issues. Although overall the video is really well made and deserve credit, it is also a bit old and is missing at least one crucial information. The temporary root password. According to the video, they will give you one, but with the newest download version for Mac, you have to make your own root password. So I thought of just adding my mini tutorial as a supplement to the video for new installer.</p><p><strong>Step one</strong> is to go to this website <a href="https://dev.mysql.com/downloads/mysql/"><em>MySQL</em></a><em> </em>and download the latest version for your MAC (sorry windows user, I don’t have experience in that field but it should be relatively similar).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4k9g8xx8JtFBh0f757a9yQ.png" /><figcaption>Once that is downloaded, follow along the installation and give your main user login password</figcaption></figure><p><strong>Step two</strong> is the big difference between the video and the current model as of this writing. In the configuration step, they will ask you to input a root password. It can be as simple as you want or something a bit more complex.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jCAt4pOhLbOAVlyEifjJEA.png" /><figcaption>I made my root password too long but can easily change it later</figcaption></figure><p><strong>Step three</strong> is similar to the video again. At this point you can pretty much follow the video but here is the written version anyway. Open up your terminal, make sure you are at the PWD section and look for your bash_profile. If you have ever installed anything through conda, you will already have a bash_profile. Using the code below in your terminal PWD, open your bash_profile:</p><pre>open -t .bash_profile</pre><pre>#And then insert the following code:</pre><pre>export PATH=${PATH}:/usr/local/mysql/bin/</pre><p>After that, save and close your bash, clear the terminal and start a new terminal by opening a new tab or a new windows. Then run the following command to new terminal:</p><pre>mysql -u root -p</pre><p><strong>Step Four </strong>is to make sure that you are connected to the MySQL server at this point (Just an FYI, I forgot this part at first). Otherwise you would get an error. If they ask for a password within the terminal, it is the password you have created (<strong>NOT YOUR COMPUTER LOGIN PASSWORD</strong>). Now you are successfully logged into the server. If you wish to change your MySQL password, run the following code:</p><pre>mysql$ ALTER USER &#39;root&#39;@&#39;localhost&#39; IDENTIFIED BY &#39;MyNewPass&#39;;<br>#The &#39;MyNewPass&#39; is the new changed password in this case</pre><pre>#You can also just run this if you forget your password:<br>mysqladmin -u root password <strong>NEWPASSWORD</strong> &lt;- this is where you put your new password</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/954/1*z3HM8ILPcgnEqBpSlB1FoA.png" /><figcaption>Once you have successfully logged in, you will see your MySQL tables</figcaption></figure><p>Now that has been set up, let’s move on to installing the MySQL Workbench. The download link can be found <a href="https://dev.mysql.com/downloads/file/?id=488575">here</a>. Once you go through the download process, make sure to move the file into your application folder, like the video suggest. It will ask you for your user ID password, which is your main computer login password. If they ask you for your root password, then it will be the new password you just created at time of installation.</p><p><strong>Step five</strong> is- if you still have your MySQL running from the start, is to open the workbench. You will see something like below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Btesa-Ohn6hZn4L_tzdshA.png" /><figcaption>If you don’t see the blue highlighted box Local instance then you don’t have your MySQL server running</figcaption></figure><p>If you don’t see the small blue box above, that means that your SQL server is not running. In order to run that, go click the apple in the top left of your screen, then System Preference. And a window like this should show up for you:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*akU5fctL8jhB3vGecGikWg.png" /><figcaption>This was also a difference between the video and myself. He was able to open MySQL through preference whereas I just get this</figcaption></figure><p>If your MySQL server is offline, your buttons will be red and it will say <em>Start MySQL Serve</em>. Just click that and you have your server ready. Then just go to your workbench and upload or load up your database and start querying.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FUcpHkYfWarM%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DUcpHkYfWarM&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FUcpHkYfWarM%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/dbddc37dcc7bfd0463b310fa230af088/href">https://medium.com/media/dbddc37dcc7bfd0463b310fa230af088/href</a></iframe><ul><li><a href="https://dev.mysql.com/downloads/mysql/">MySQL :: Download MySQL Community Server</a></li><li><a href="https://dev.mysql.com/downloads/file/?id=488575">MySQL :: Begin Your Download</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bdfb0af88666" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[LGBM and Feature Extraction]]></title>
            <link>https://medium.com/@imamun/lgbm-and-feature-extraction-ae87fe83ea77?source=rss-41404f6cc939------2</link>
            <guid isPermaLink="false">https://medium.com/p/ae87fe83ea77</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[feature-extraction]]></category>
            <category><![CDATA[lightgbm]]></category>
            <category><![CDATA[towards-data-science]]></category>
            <dc:creator><![CDATA[Iftekher Mamun]]></dc:creator>
            <pubDate>Sun, 18 Aug 2019 01:24:45 GMT</pubDate>
            <atom:updated>2019-08-18T01:24:45.351Z</atom:updated>
            <content:encoded><![CDATA[<h4>Using Light Gradient Boosting Machine model to find important features in a dataset with many features</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*NpEjIErpAgmhNMJK" /><figcaption><a href="https://i1.wp.com/www.codeastar.com/wp-content/uploads/2018/06/gradient.png?fit=1024%2C603&amp;ssl=1">Source</a></figcaption></figure><p>On my last post, I talked about how I used some basic EDA and Seaborn to find information about my molecule prediction project. You can find that post by clicking here: <a href="https://medium.com/@imamun/steps-before-machine-learning-417a2812a1cc">Steps Before Machine Learning</a>. I learned by the end I finished my heatmap/ correlation map for my data that Seaborn it self was not sufficient. Since my dataset is rather massive, I needed to look into other methods to help visualize and at the end highlight important features.</p><p>I went through multiple different visualizer such as plotly and D3.js. Plotly just was not able to handle even the subset of data as it kept breaking most likely due to the categorical variables. And after many attempts I was not able to set up D3.js with my program. The preset dataframe D3 had set did not line up with my dataset and I was not able to align them at the time.</p><p>So I decided to look into machine learning tools like the Principal Component Analysis that will help identify my important features. After some search and advice, I came across <a href="https://lightgbm.readthedocs.io/en/latest/">Light Gradient Boost Machines</a>, or LGBM. Based on what I read, this was perfect as it would give me a baseline model using my subsample and it would also provide my with what features are contributing most to the prediction of the target variable.</p><p>However, it was very difficult to install LGBM on my MAC. It kept crashing, even when I went through the official documentation. Then I finally found a detailed installation of LGBM using brew install on my terminal. The installation guide can be <a href="https://lightgbm.readthedocs.io/en/latest/Installation-Guide.html#macos"><strong>found here</strong></a><strong>.</strong> Remember to check your computer OS as installing for the wrong system will cause it to crash. After following the installation, I was able to import it directly into my jupyter notebook with the following command:</p><pre>import lightgbm</pre><p>Now that I have the most important library ready, I decided to train test split my dataset using sklearn.</p><pre>from sklearn.model_selection import train_test_split</pre><pre>feature= df_dropped_sample.drop([&#39;scalar_coupling_constant&#39;], axis=1)</pre><pre>target= df_dropped_sample[[&#39;scalar_coupling_constant&#39;]]</pre><pre>feature_train, feature_test, target_train, target_test= train_test_split(feature, target, test_size=0.12)</pre><p>With that finished, I wanted to check the length and shape of my dataset.</p><pre>print(&#39;total feature training features: &#39;, len(feature_train))<br>print(&#39;total feature testing features: &#39;, len(feature_test))<br>print(&#39;total target training features: &#39;, len(target_train))<br>print(&#39;total target testing features: &#39;, len(target_test))</pre><pre>#And the results were:</pre><pre>total feature training features:  40991<br>total feature testing features:  5590<br>total target training features:  40991<br>total target testing features:  5590</pre><pre>feature_train.shape<br>(40991, 71)</pre><pre>target_train.shape<br>(40991, 1)</pre><p>Okay, now that I have a training and testing set, it was time to import them into the lightgbm model. I used an example from <a href="https://www.kaggle.com/ezietsman/simple-python-lightgbm-example">kaggle</a> to create a basic lgbm model. For an lgbm model to work, you have to instantiate your dataframe into their own model:</p><pre>train_data = lightgbm.Dataset(feature_train, label=target_train, categorical_feature=categorical_features)</pre><pre>test_data = lightgbm.Dataset(feature_test, label=target_test)</pre><p>Now we have our training and testing set ready. Then I took the basic parameter from the kaggle example and just imported that into my code:</p><pre>#basic parameter:<br>parameters = {<br>    &#39;application&#39;: &#39;binary&#39;,<br>    &#39;objective&#39;: &#39;binary&#39;,<br>    &#39;metric&#39;: &#39;auc&#39;,<br>    &#39;is_unbalance&#39;: &#39;true&#39;,<br>    &#39;boosting&#39;: &#39;gbdt&#39;,<br>    &#39;num_leaves&#39;: 31,<br>    &#39;feature_fraction&#39;: 0.5,<br>    &#39;bagging_fraction&#39;: 0.5,<br>    &#39;bagging_freq&#39;: 20,<br>    &#39;learning_rate&#39;: 0.05,<br>    &#39;verbose&#39;: 0<br>}</pre><p>Finally, created the model to fit and run the test:</p><pre>model = lightgbm.train(parameters,<br>                       train_data,<br>                       valid_sets=test_data,<br>                       num_boost_round=5000,<br>                       early_stopping_rounds=100)</pre><p>At the <em>[749] valid_0’s auc: 0.999874</em> run, I reached an accuracy of 99%. It’s obviously overfitting on the data, but my primary concern is which features are being weighted more. Thankfully, lgbm has a built in plot function that shows you exactly that:</p><pre>ax = lightgbm.plot_importance(model, max_num_features=40, figsize=(15,15))<br>plt.show()</pre><p>And it showed me this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cz03PMzY0CPa8b5_U2DbsA.png" /></figure><p>Here we see that most of the categorical and pointless and that is obvious. But we also see the top ten features we should concern our machine with. The next step of this project will be to focus on using this feature to build a proper linear regression machine.</p><ul><li><a href="https://lightgbm.readthedocs.io/en/latest/">Welcome to LightGBM&#39;s documentation! - LightGBM 4.6.0.99 documentation</a></li><li><a href="https://www.kaggle.com/ezietsman/simple-python-lightgbm-example">Simple Python LightGBM example</a></li><li><a href="https://lightgbm.readthedocs.io/en/latest/Installation-Guide.html#macos">Installation Guide - LightGBM 2.2.4 documentation</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ae87fe83ea77" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Steps Before Machine Learning]]></title>
            <link>https://medium.com/@imamun/steps-before-machine-learning-417a2812a1cc?source=rss-41404f6cc939------2</link>
            <guid isPermaLink="false">https://medium.com/p/417a2812a1cc</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[correlation]]></category>
            <category><![CDATA[towards-data-science]]></category>
            <category><![CDATA[eda]]></category>
            <category><![CDATA[visualization]]></category>
            <dc:creator><![CDATA[Iftekher Mamun]]></dc:creator>
            <pubDate>Sat, 10 Aug 2019 22:42:13 GMT</pubDate>
            <atom:updated>2019-08-10T22:42:13.051Z</atom:updated>
            <content:encoded><![CDATA[<h4>Looking at the EDA process for a Linear Regression Machine Learning Algorithm</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/240/0*z9yc6nP7WUMWKYm_" /><figcaption><a href="https://storage.googleapis.com/kaggle-competitions/kaggle/14313/logos/thumb76_76.png?t=2019-05-16-16-56-19">Source</a></figcaption></figure><p>Recently, I started a project from the Kaggle competition for <a href="https://www.kaggle.com/c/champs-scalar-coupling?utm_medium=email&amp;utm_source=intercom&amp;utm_campaign=champs-email-launch">predicting molecular properties</a>. This is my first time working with data of this size by myself and I soon realized that I was over my head. The dataset itself is massive enough that I was not even able to upload them to my github through the regular command prompt. It was easier to just put them in a gitignore file and upload only my working files onto github for tracking.</p><p>Unlike my other projects, this involved merging of CSV like you would do with SQL but on Pandas (it was just easier than to build a database for querying). Then do some Extrapolatory Data Analysis, which takes some time given the size of the dataset. In today’s post, I just want to focus on the very basic EDA that I accomplished with their codes and the results.</p><p>First step is to always load up necessary libraries. For now, I will list the libraries as I use them.</p><pre>from IPython.display import display<br>data_path = &#39;../Molecular_Properties&#39;<br>files_names = !ls $data_path/*.csv<br>files_names</pre><p>I import the python display library and then create a variable that holds the main name of my directory. This is where all the CSVs are currently being held. Then I assigned that variable through the ls command and linking it with any files that contains .CSV on it. Basically, the ls command list out all files within the directory and the /*.csv looks for any file that ends with .csv within the data path directory. The result is this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/938/1*xjjAoxD7kSm1YCvaoroUZw.png" /></figure><pre>import pandas as pd<br>data_dict = {}<br>for name in files_names:<br>    data_dict[name.split(&#39;/&#39;)[-1][:-4]] = pd.read_csv(name)</pre><p>The code above import pandas and through the split function, creates new tables with split being under ‘name’. Following that, you have your dataframe now created. Then it is time to join them. Thankfully someone already did this, so I will just paste the code:</p><pre>df_complete = data_dict[&#39;train&#39;].copy()<br>df_complete = df_complete.join(data_dict[&#39;potential_energy&#39;].set_index(&#39;molecule_name&#39;), on=&#39;molecule_name&#39;)<br>df_complete = df_complete.join(data_dict[&#39;dipole_moments&#39;].set_index(&#39;molecule_name&#39;), on=&#39;molecule_name&#39;, lsuffix=&#39;dipole_moments_&#39;)<br>df_complete = df_complete.join(data_dict[&#39;magnetic_shielding_tensors&#39;].set_index([&#39;molecule_name&#39;, &#39;atom_index&#39;]), on=[&#39;molecule_name&#39;, &#39;atom_index_0&#39;], lsuffix=&#39;_atom0&#39;)<br>df_complete = df_complete.join(data_dict[&#39;magnetic_shielding_tensors&#39;].set_index([&#39;molecule_name&#39;, &#39;atom_index&#39;]), on=[&#39;molecule_name&#39;, &#39;atom_index_1&#39;], lsuffix=&#39;_atom1&#39;)<br>df_complete = df_complete.join(data_dict[&#39;mulliken_charges&#39;].set_index([&#39;molecule_name&#39;, &#39;atom_index&#39;]), on=[&#39;molecule_name&#39;, &#39;atom_index_0&#39;], lsuffix=&#39;_atom0&#39;)<br>df_complete = df_complete.join(data_dict[&#39;mulliken_charges&#39;].set_index([&#39;molecule_name&#39;, &#39;atom_index&#39;]), on=[&#39;molecule_name&#39;, &#39;atom_index_1&#39;], lsuffix=&#39;_atom1&#39;)<br>df_complete = df_complete.join(data_dict[&#39;scalar_coupling_contributions&#39;].set_index([&#39;molecule_name&#39;, &#39;atom_index_0&#39;, &#39;atom_index_1&#39;]), on=[&#39;molecule_name&#39;, &#39;atom_index_0&#39;, &#39;atom_index_1&#39;], rsuffix=&#39;_scc&#39;)<br>df_complete = df_complete.join(data_dict[&#39;structures&#39;].set_index([&#39;molecule_name&#39;, &#39;atom_index&#39;]), on=[&#39;molecule_name&#39;, &#39;atom_index_0&#39;], lsuffix=&#39;_atom0_structure&#39;)<br>df_complete = df_complete.join(data_dict[&#39;structures&#39;].set_index([&#39;molecule_name&#39;, &#39;atom_index&#39;]), on=[&#39;molecule_name&#39;, &#39;atom_index_1&#39;], lsuffix=&#39;_atom1_structure&#39;)</pre><pre>df= df_complete.drop([&#39;id&#39;], axis=1)</pre><p>I noticed that there was an additional index column at the end of it all, so I decided to drop it. Now, looking at my dataset, I realized that my data contains <strong>4658147 rows × 42</strong> columns of information. That is massive and when I tried to do any form of statistic or modeling it would take too long and my kernel would crash. This was frustrating so I decided to take a subsample of my data set instead.</p><pre>df_subsample=  df.sample(frac=0.01, random_state=1)</pre><p>Now my subsample only contains 1% of the total data. That may not seem a lot, but in reality, this subsample still contains <strong>46581 rows × 42 columns</strong>. Thankfully, this data is much more manageable without using cloud computing. Then I wanted to do some visualization with seaborn:</p><pre>import seaborn as sns<br>sns.pairplot(df_subsample)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mwgAlZ6l354Yu6wL3SseEg.png" /><figcaption>This is only a small portion of the actual pairplot graph. As you can see, it is very hard to decipher what it says.</figcaption></figure><p>That wasn’t very helpful. Then I decided, let’s look at all possible categorical variables using this line and found 5 total categorical variables</p><pre>#finding dummies in all dataset<br>for col in df.select_dtypes(include=[object]):<br>    print(df[col].value_counts(dropna=False), &quot;\n\n&quot;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/736/1*2NK2zVfTNtuq1duuCL2RFQ.png" /><figcaption>The molecule_name contained too many unique characters so I decided to drop it. And atom_atom1_structure contained only H. That was dropped as well</figcaption></figure><pre>df_dropped_sample= df_subsample.drop(columns=[&#39;molecule_name&#39;, &#39;atom_atom1_structure&#39;])</pre><p>After dropping two of the five categorical variables, now I had to decide how to convert those remaining three into dummy variables. There are two main ways to go around it. One is Label Encoder and the other one is One Hot Encoding. Label Encoder would label all these unique variables as 1, 2, 3 etc. depending on their location, however the machine might refer to this as some form of order when that is not true. The secondary option, One Hot Encoder is more viable even though it will add more columns to the data sets.</p><pre>df_dropped_sample[&#39;type&#39;]= pd.Categorical(df_dropped_sample[&#39;type&#39;])<br>dfDummies = pd.get_dummies(df_dropped_sample[&#39;type&#39;], prefix = &#39;category&#39;)<br>df_dropped_sample = pd.concat([df_dropped_sample, dfDummies], axis=1)df_dropped_sample[&#39;type_scc&#39;]= pd.Categorical(df_dropped_sample[&#39;type_scc&#39;])<br>dfDummies = pd.get_dummies(df_dropped_sample[&#39;type_scc&#39;], prefix = &#39;category&#39;)<br>df_dropped_sample = pd.concat([df_dropped_sample, dfDummies], axis=1)<br>df_dropped_sample[&#39;atom&#39;]= pd.Categorical(df_dropped_sample[&#39;atom&#39;])<br>dfDummies = pd.get_dummies(df_dropped_sample[&#39;atom&#39;], prefix = &#39;category&#39;)<br>df_dropped_sample = pd.concat([df_dropped_sample, dfDummies], axis=1)</pre><p>Those lines above converted the targeted categorical variables into dummy variables. I know that I should have just created a for loop function to do it for me, but it was only 3 categories and it was quicker just copy pasting. Next, I had to drop the original 3 categorical so they do not interfere with my dataframe:</p><pre>df_dropped_sample= df_dropped_sample.drop([&#39;type&#39;, &#39;type_scc&#39;, &#39;atom&#39;], axis=1)</pre><pre>df_dropped_sample = df_dropped_sample[df_dropped_sample.columns].astype(float)</pre><p>The second line of codes convert all my columns to float integers. You can choose to make them simple integers as well. This step is crucial in when doing visualization.</p><p>With all of that finished, I decided to use seaborn again to look at a heatmap (remember to import matplotlib inline beforehand):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/858/1*JZo6JaxC27HQ7FCbUsIldw.png" /><figcaption>heatmap of all the data</figcaption></figure><p>Wait, what am I even looking at? Where are the correlation? Why are all the colors barely correlated? Are there no significant relationships between each variables? This brought me more questions than answers. So I decided to focus the visual code a bit more and look at the correlational relationship instead:</p><pre>df_sample_viz= df_dropped_sample.iloc[:,1:]</pre><p>That showed that majority of my features have little to no correlation at all. There was only one more step I can possibly take: to look at the correlation heatmap instead:</p><pre>sns.heatmap(df_sample_viz.corr(), center=0, robust=True, square=True)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/888/1*Px5ay0U9i2PGntsT3Epr3A.png" /></figure><p>And look at that. Majority of the data are indeed independent of each other. Very few features are correlated at 0.75 or above. Adding the following snippets below showed that the data frame consisted of no significant correlation:</p><pre>abs(df_sample_viz.corr())&gt; 0.70</pre><p>Then what did my data tell me so far? I learned that there were categorical variables that affected my data visualization. I learned that my data set is not correlated at all, so deciding on dimensionality reduction will be tricky. I also learned that the competition held on kaggle is no joke and I need to work and think differently if I want to participate seriously in the future.</p><p>I will continue to work on this and update once I finish running the base model. Thanks for reading.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=417a2812a1cc" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>