Skip to content

Instantly share code, notes, and snippets.

View ikanez's full-sized avatar

Hafidz Zulkifli ikanez

View GitHub Profile
@ikanez
ikanez / video-subtitles-via-whisper.py
Created September 27, 2022 09:29 — forked from rasbt/video-subtitles-via-whisper.py
Script that creates subtitles (closed captions) for all MP4 video files in your current directory
# Sebastian Raschka 09/24/2022
# Create a new conda environment and packages
# conda create -n whisper python=3.9
# conda activate whisper
# conda install mlxtend -c conda-forge
# Install ffmpeg
# macOS & homebrew
# brew install ffmpeg
# Ubuntu
@ikanez
ikanez / openai-get-skills-context.py
Last active May 17, 2021 14:43
Prompting GPT-3 with earlier examples.
def get_skills_context(resume):
response = openai.Completion.create(
engine="davinci",
prompt="""This is a resume parser that extracts skills context from resume.
resume: {resume1}
parsed_contextual_skills: {extract1}
###
@ikanez
ikanez / sample-resume-extract.py
Last active May 17, 2021 14:42
An example of experience and extracted soft skills (with added context)
resume_1 = """
QUALIFICATIONS
Highly motivated, customer focused professional with extensive experience in key client development and
retention. Skilled in creating and growing solid customer relationships, needs analysis, and account activity
tracking.
EXPERIENCE
EXPERIAN CORP 1998-2007
Account Manager – Costa Mesa / Sacramento, CA 2002-2007
Primary customer contact for the nation's largest collector and provider of real estate focused public record data.
Industries serviced: Lending, Title, Investor and Government. Territory – AL, LA, MS, OK, TX
@ikanez
ikanez / openai-search-job-classification.py
Created May 17, 2021 14:38
Prompt for GPT-3 for search capability
# based on job classification on jobstreet.com
job_classification = [
"accounting/finance",
"admin/human resources",
"sales/marketing",
"arts/media/communications",
"services",
"hotel/restaurant",
"education/training",
"computer/IT",
@ikanez
ikanez / gpt3-job-specialization.py
Created May 17, 2021 14:36
Prompting GPT-3 with job titles, description, and expected syntax of job category/specialization
def call_openapi(title, desc):
response = openai.Completion.create(
engine="davinci",
prompt="""This is a job specialization classifier
Job title: Account Executive
Job description: Handle full set of accounts.\n
Familiar with Income Tax filing.\n
Maintain daily cash flow and reporting.\n
Prepare monthly and annual financial reports.\n
@ikanez
ikanez / qa-banking-context.py
Created May 17, 2021 14:30
Prompting the GPT-3 with "banking" context.
def call_openapi(question):
response = openai.Completion.create(
engine="davinci",
prompt="""
This is a banking expert.
Q: What is interest rate?
A: The interest rate is the amount a lender charges for the use of assets expressed as a percentage of the principal.
Q: What is PD?
@ikanez
ikanez / sarima_backtest_mlflow.py
Created July 13, 2019 19:41
Evaluate performance of best sarima model over multiple time window and log into mlflow
from datetime import timedelta
num_window = 10
def last_day_of_month(any_day):
next_month = any_day.replace(day=28) + timedelta(days=4) # this will never fail
return next_month - timedelta(days=next_month.day)
with mlflow.start_run(run_name='sarima_backtest'):
t1 = pd.to_datetime('2017-01-31')
@ikanez
ikanez / sarimax_model_param.py
Created July 13, 2019 17:26
Find best parameter for sarimax model and log useful stuff into MLflow
# Initial approximation of parameters
Qs = range(0, 2)
qs = range(0, 3)
Ps = range(0, 3)
ps = range(0, 3)
D=1
d=1
parameters = product(ps, qs, Ps, Qs)
parameters_list = list(parameters)
len(parameters_list)
@ikanez
ikanez / importing_mlflow.py
Created July 13, 2019 01:26
Importing mlflow library
import os
import mlflow
import mlflow.sklearn
# Set the experiment name to an experiment
mlflow.set_experiment("/Shared/experiments/cryptocurrency/analysis-forecasting-1")
@ikanez
ikanez / tracking_param.py
Last active July 13, 2019 01:25
Tracking parameters for MLflow
for param in parameters_list:
# start mlflow run
with mlflow.start_run(run_name='arima_param'):
# log parameters
mlflow.log_param('param-qs', param[0])
mlflow.log_param('param-ps', param[1])
try:
model = SARIMAX(btc_month.close_box, order=(param[0], d, param[1])).fit(disp=-1)