Skip to content

Instantly share code, notes, and snippets.

View micaleel's full-sized avatar
:octocat:
I may be slow to respond.

Khalil micaleel

:octocat:
I may be slow to respond.
View GitHub Profile
Explore how embeddings are created with Autoencoders
* https://blog.eto.ai/vector-similarity-search-with-duckdb-44dec043532a
* https://medium.com/kirey-group/autoembedder-training-embedding-layers-on-unsupervised-tasks-fc364c0f6eec
* https://www.kaggle.com/code/marlesson/autoencoder-embedding-for-food/notebook
regs = regs or [0, 0]
user_input = Input(shape=(1,), dtype="int32", name="user_input")
item_input = Input(shape=(1,), dtype="int32", name="item_input")
user_embeds = Embedding(
input_dim=num_users,
output_dim=embed_size,
embeddings_initializer="normal",
embeddings_regularizer=l2(regs[0]),
input_length=1,
% solvers for DEs in ode.m
% TODO Insert relevant values into `range` and `initial_conditions`
% NOTE initial_conditions is a vector (ordered collection) of input values that will
% unpacked in ode.m file into the X, L, S, N, and H variables respectively.
range = [1:50]
initial_conditions = [600, 3, 0, 3, 3]
# Use ode45 solver
[time_solution, var_solution] = ode45(@ode_sys, range, initial_conditions)
@micaleel
micaleel / ode.m
Last active March 16, 2021 10:42
% General constants obtained from Section 3.1
mu_X_max = 0, 275
K_XS = 0.0624
K_iXS = 12.40
K_XN = 0.0812
K_iXN = 0.6250
K_I = 45.50
K_iI = 297.75
A_0X = 0.6175
E_aX = 25.9243
@micaleel
micaleel / split.py
Created November 23, 2020 12:25
For splitting recommendation data loaded into a Pandas DataFrame
from typing import List, Tuple
import numpy as np
import os
import pandas as pd
DATA_DIR = ...
data = pd.read_csv(
os.path.join(DATA_DIR, "ml-100k", "u.data"),
"""
Yelp review processor.
The module clusters Yelp features based on their sentence similarities.
This module takes a set of reviews as inputs, then generates two files:
- items.csv - item and their properties.
- extractions.csv - features and sentiments mined from item reviews.
"""
@micaleel
micaleel / custom_crossfold_surpriselib.ipynb
Last active October 30, 2019 11:19
Using custom cross-fold splits with SurpriseLib
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
ratings_df = load_data(ML100K, implicit=IMPLICIT, n_users=NUM_USERS)
train_df, test_df = train_test_split(ratings_df, loo=True)
sampler = NegativeSampler(ratings_df['item_id'].unique()).fit(train=train_df, test=test_df)
train_df = sampler.transform(train_df, train=True, size=50)
test_df = sampler.transform(test_df, train=False, size=10)
gmf = GMF(n_users=ratings_df.user_id.nunique(), n_items=ratings_df.item_id.nunique(), implicit=IMPLICIT)
reco = Recommender(keras_model=gmf, loss='binary_crossentropy', optimizer='adam', )
reco.fit(data=train_df, verbose=True, epochs=10)