Skip to content

Instantly share code, notes, and snippets.

@victor-fdez
victor-fdez / taco_sales_lstm.py
Created August 27, 2023 16:37
Predicting daily taco sales using last 30 days of Sales
import numpy as np
import tensorflow as tf
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import LSTM, Dense
# Seed for reproducibility
np.random.seed(42)
# Generating random sales data for a year for three taco types
days = 365
@victor-fdez
victor-fdez / sales_rnn.py
Created August 2, 2023 00:10
sales predictor with recurrent neural network
import numpy as np
from keras.models import Sequential
from keras.layers import SimpleRNN, Dense
from sklearn.preprocessing import MinMaxScaler
# Generating data for 30 days
np.random.seed(0)
days_of_week = np.tile(np.arange(0, 7), 5)[:30]
weather = np.random.rand(30)
special_promotions = np.random.randint(0, 2, 30)
@victor-fdez
victor-fdez / taco_perceptron.py
Created July 18, 2023 12:37
Taco perceptron example to demonstrate prediction of spicyness
from sklearn.linear_model import Perceptron
import numpy as np
# Flavor profile of the taco [spice, sweetness, tanginess]
training_inputs = np.array([[0, 0, 1], [1, 0, 0], [0, 1, 0], [1, 1, 1]])
# Corresponding labels for the flavors [not spicy, spicy, not spicy, spicy]
labels = np.array([0, 1, 0, 1])
# Initialize and train the Perceptron
@victor-fdez
victor-fdez / taco_perceptron.py
Created July 11, 2023 12:13
Taco Perceptron to Judge Spice Meat Tacos
from sklearn.linear_model import Perceptron
import numpy as np
# Let's represent 'beef' as 1 and 'chicken' as 0
# and 'spicy' as 1 and 'mild' as 0
# Input data: [spice_level, type_of_meat]
X = np.array([
[1, 1], # Spicy beef taco
[0, 1], # Mild beef taco
@victor-fdez
victor-fdez / taco_love.py
Created July 4, 2023 02:36
Taco Love - Logistics Regression
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LogisticRegression
import pandas as pd
import numpy as np
# let's assume these are our taco features and the target column is whether the person liked the taco or not
taco_data = pd.DataFrame({
'spice_level': np.random.randint(1, 10, 100), # on a scale of 1-10
'meat_type': np.random.choice(['beef', 'chicken', 'pork'], 100), # type of meat
'serving_size': np.random.choice(['small', 'medium', 'large'], 100), # serving size
@victor-fdez
victor-fdez / taco_regression.py
Created July 1, 2023 14:00
Taco Linear Regression Model to Predict Price based on Temperature
# Import necessary libraries
from sklearn.linear_model import LinearRegression
import numpy as np
# Assume these are the temperatures (in degree Fahrenheit)
temperatures = np.array([60, 65, 70, 75, 80, 85, 90]).reshape((-1, 1))
# And these are the corresponding taco prices (in dollars)
taco_prices = np.array([1.5, 1.6, 1.7, 1.9, 2.0, 2.1, 2.3])
{
"id" : 229781,
"resource_state" : 3,
"*name" : "Hawk Hill",
"*activity_type" : "Ride",
"*distance" : 2684.82,
"*average_grade" : 5.7,
"*maximum_grade" : 14.2,
"*elevation_high" : 245.3,
"*elevation_low" : 92.4,

Keybase proof

I hereby claim:

  • I am victor-fdez on github.
  • I am vjft (https://keybase.io/vjft) on keybase.
  • I have a public key ASA5qEBpjt2MsREv55ImjdbWyXtXJBCsttyMHFfi3azAyAo

To claim this, I am signing this object: