Skip to content

Instantly share code, notes, and snippets.

View yashprakash13's full-sized avatar
📱

Yash Prakash yashprakash13

📱
  • DNEG
  • Toronto, CA
  • 02:33 (UTC -05:00)
View GitHub Profile
from sklearn.model_selection import train_test_split
X, y = df.drop('DEATH_EVENT', axis=1), df['DEATH_EVENT']
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.3)
X_train.shape, X_test.shape, y_train.shape, y_test.shape
@yashprakash13
yashprakash13 / df.py
Created December 26, 2021 15:55
Sklearn Pipeline
df = pd.read_csv('data.csv')
df.head()
import requests
import pandas as pd
from prefect import task, Flow
import json
@task
def extract(url_from):
response = requests.get(url_from)
@yashprakash13
yashprakash13 / helloworld.py
Created May 30, 2021 17:00
Gist starter code to set up Docker Development Environment in VSCode.
from fastapi import FastAPI
app = FastAPI()
@app.get("/")
async def root():
return {"message": "Hello World"}
@yashprakash13
yashprakash13 / app.py
Created April 4, 2021 17:26
FastApi example
import uvicorn
from fastapi import FastAPI
from model import SentimentModel, SentimentQueryModel
app = FastAPI()
model = SentimentModel()
@app.post('/predict')
def predict(data: SentimentQueryModel):
data = data.dict()
@yashprakash13
yashprakash13 / .gitignore
Created December 19, 2020 15:24 — forked from GhostofGoes/.gitignore
Basic .gitignore template for Python projects
# Editors
.vscode/
.idea/
# Vagrant
.vagrant/
# Mac/OSX
.DS_Store
@Database(entities = [Word::class], version = 1, exportSchema = false)
abstract class WordDatabase : RoomDatabase() {
abstract fun wordDao() : WordDao
companion object{
// For Singleton instantiation
@Volatile private var INSTANCE: WordDatabase? = null
fun getInstance(context: Context): WordDatabase {
@Insert(onConflict = OnConflictStrategy.REPLACE)
fun insertWord(word: Word)
@Query ("Select * from word_table")
fun getAllWordsPaged() : DataSource.Factory<Int, Word>
@Query("Delete from word_table where name like :name")
fun deleteWord(name: String)
@Query("Update word_table set name = :name, meaning = :meaning, audioPath = :audiopath where name like :originalName")
@Entity(tableName = "word_table")
data class Word (
@PrimaryKey
@NonNull
var name: String,
var meaning: String? = null,
var audioPath: String? = null
)
# Install R + RStudio on Ubuntu 16.04
sudo apt-key adv –keyserver keyserver.ubuntu.com –recv-keys E084DAB9
# Ubuntu 12.04: precise
# Ubuntu 14.04: trusty
# Ubuntu 16.04: xenial
# Basic format of next line deb https://<my.favorite.cran.mirror>/bin/linux/ubuntu <enter your ubuntu version>/
sudo add-apt-repository 'deb https://ftp.ussg.iu.edu/CRAN/bin/linux/ubuntu xenial/'
sudo apt-get update