This file contains hidden or 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
| 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 |
This file contains hidden or 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
| df = pd.read_csv('data.csv') | |
| df.head() |
This file contains hidden or 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 requests | |
| import pandas as pd | |
| from prefect import task, Flow | |
| import json | |
| @task | |
| def extract(url_from): | |
| response = requests.get(url_from) |
This file contains hidden or 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
| from fastapi import FastAPI | |
| app = FastAPI() | |
| @app.get("/") | |
| async def root(): | |
| return {"message": "Hello World"} |
This file contains hidden or 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 uvicorn | |
| from fastapi import FastAPI | |
| from model import SentimentModel, SentimentQueryModel | |
| app = FastAPI() | |
| model = SentimentModel() | |
| @app.post('/predict') | |
| def predict(data: SentimentQueryModel): | |
| data = data.dict() |
This file contains hidden or 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
| # Editors | |
| .vscode/ | |
| .idea/ | |
| # Vagrant | |
| .vagrant/ | |
| # Mac/OSX | |
| .DS_Store |
This file contains hidden or 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
| @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 { |
This file contains hidden or 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
| @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") |
This file contains hidden or 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
| @Entity(tableName = "word_table") | |
| data class Word ( | |
| @PrimaryKey | |
| @NonNull | |
| var name: String, | |
| var meaning: String? = null, | |
| var audioPath: String? = null | |
| ) |
This file contains hidden or 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
| # 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 |