Name | Link | Feed |
---|---|---|
Artificial Intelligence | https://lexfridman.com/ai/ | https://lexfridman.com/category/ai/feed/ |
DataFramed | https://www.datacamp.com/community/podcast | https://feeds.buzzsprout.com/147669.rss |
This Week in Machine Learning & Artificial Intelligence (AI) Podcast | https://twimlai.com | http://twimlai.libsyn.com/rss |
- Ctrl + R Switching workspaces
- Ctrl + P Go to file
- Ctrl+B Toggle Sidebar Visibility
- F4 Focus Next Search Result
- Shift+F4 Focus Previous Search Result
- Ctrl+` Toggle Integrated Terminal
- Ctrl+Space Auto-complete
- Crtl + Alt + up (or down): repeat cursor
- ALT + CLICK — Repeat cursor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ======================================================================= | |
# Print a summary of a pandas dataframe and its columns | |
# ======================================================================= | |
def df_summary(df): | |
print(f'Dataframe has {df.shape[0]:,} rows and {df.shape[1]:,} columns') | |
if len(df) > 1: | |
summary = pd.DataFrame(df.dtypes, columns=['dtype']).reset_index() | |
summary.rename(columns={'index': 'feature'}, inplace=True) | |
summary['missing'] = df.isnull().sum().values | |
summary['uniques'] = df.nunique().values |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import functools | |
import time | |
def readable_time(t): | |
a = '' | |
if t < 1: | |
a = f'{t:.2f} sec' | |
elif t < 60: | |
a = f'{t:.0f} sec' | |
elif t < 3600: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# SHAP's force plot does not label all the important features | |
# We usually need to get the top (20) feautures that affect a decision for a particular instance | |
# In addition to their name, the features' values and their shapley values are also required. | |
# The below snippet | |
# 1. creates a dataframe containing all the features, their shapley value and their actual value | |
# 2. and exports the dataframe to a csv file | |
# 3. It also displays the force plot | |
import shap | |
shap.initjs() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def compare_df_columns(df1, df2): | |
""" | |
Compare the columns of two dataframes (including their types) | |
""" | |
matched = True | |
# Compare number of rows | |
if df1.shape[0] != df2.shape[0]: | |
print(f'Row numbers do not match {df1.shape[0]:,} vs {df2.shape[0]:,}') | |
matched=False |
To start the docker container, run the following command:
docker run -d -p 8787:8787 -v C:\source:/home/rstudio -e ROOT=TRUE -e PASSWORD=rstudio rocker/rstudio
In the above command, I'm mounting "C:\source" to "/home/rstudio", thus providing the container access to all the contents of "C:\source".
If you want to mount multiple paths use -v multiple time. Example:
The extensions to install:
- R (https://marketplace.visualstudio.com/items?itemName=Ikuyadeu.r)
- R LSP Client (https://marketplace.visualstudio.com/items?itemName=REditorSupport.r-lsp)
- R Tools (https://marketplace.visualstudio.com/items?itemName=Mikhail-Arkhipov.r)
For R LSP, you need to have R language server installed.
OlderNewer