Skip to content

Instantly share code, notes, and snippets.

@matrix303
matrix303 / Boruta_Classification.py
Last active August 6, 2020 03:09
Boruta and Classification #python #DataScience
feat_true, feat_top_rank = boruta_MP(l_mat,l_label,l_title,l_features,nest='auto',top_rank=5)
# TRUE Feat
l_cv = 3,5,6,7
times = 5
for i,feat in enumerate(true_feat_T10_R5_tres100):
l_mat_true_T10_R5_tres100, l_label_true_T10_R5_tres100, l_title_true_T10_R5_tres100, _ = get_data_lists(feat)
# print(feat)
@matrix303
matrix303 / feature_ranking.py
Created August 6, 2020 02:13
Feature Ranking #python #DataScience
TOP_FEATURES = len(feature_list)
forest = RandomForestClassifier(n_estimators=10,max_depth=6)#, random_state=3)
forest.fit(l_mat[1],l_label[1])
importances = forest.feature_importances_
std = np.std(
[tree.feature_importances_ for tree in forest.estimators_],
axis=0
)
@matrix303
matrix303 / Data_Ingestion.py
Last active August 6, 2020 01:52
Data Ingestion #python #DataScience
def get_data_lists(selected_col=[], indvGroupOnly=False):
# Data input
xls = pd.ExcelFile("final_data_NMR_DILC_comb.xlsx")
day1_org = pd.read_excel(xls,"Day1")
day3_org = pd.read_excel(xls,"Day3")
day10_org = pd.read_excel(xls,"Day10-11")
# print(selected_col)
if len(selected_col)>0:
@matrix303
matrix303 / Apache
Created February 21, 2020 19:24
Apache #hosting
v host file
/usr/local/etc/httpd/extra/httpd-vhosts.conf
start apache
sudo apachectl start
start wsgi
mod_wsgi-express start-server app.wsgi
start wsgi nohup
@matrix303
matrix303 / git init
Created October 7, 2019 02:30
Git Setup Local #git
git init
git add .
git commit -m "message"
git remote add origin __URL__
git push -u origin master
@matrix303
matrix303 / ankitips.py
Created July 27, 2019 13:54
Get all Tags Anki
# WRITE CODE BLOCK IN DEBUG CONSOLE (cmd shift D in anki main window)
# RUN CODE w Cmd Return
#GET ALL TAGS
from aqt import mw
out=mw.col.tags.all()
for t in out:
print(t)
@matrix303
matrix303 / argparse.py
Last active July 17, 2019 14:21
System Arguments - Terminal File Input #python
# include standard modules
import argparse
# initiate the parser
parser = argparse.ArgumentParser()
parser.add_argument("-V", "--version", help="show program version", action="store_true") #true of false b/c action
parser.add_argument("-W", "--width", help="store width") #no set action = store value
# read arguments from the command line
args = parser.parse_args()
@matrix303
matrix303 / General File System Commands
Last active July 1, 2019 22:23
SSH Commands #Shell
**General File/Directory Commands**
rm _fileName_ -> remove file
rm -rf _dirName_ -> remove folder
@matrix303
matrix303 / command.sh
Created June 25, 2019 18:50
OneDrive Remove .dsStore #OneDrive
find /users/username/onedrivepath/ -name ".DS_Store" -depth -exec rm {} \;
@matrix303
matrix303 / profilingpkg.py
Last active June 25, 2019 18:50
Profiling Python File RunTime #pythonTips
c_profiler -> gives times of functions
line_profiler -> gives times of line by lie
#@profile -> needed for linebyline
def func():
aklw;ejlkajselksjlkjaslkejawlkjwel;kaj
terminal: python -m cProfile -s cumulative profileme.py
terminal: kernprof -l -v profileme.py #todo cpu profiling line-by-line -> needs @profile for the func you need lbyl for
terminal: python -m memory_profiler profileme.py #todo memory profiling -> need @profile for func you want memory details for