Skip to content

Instantly share code, notes, and snippets.

View siva2k16's full-sized avatar
💭
Emprical Learner

siva2k16

💭
Emprical Learner
View GitHub Profile
#https://mlflow.org/docs/latest/tutorials-and-examples/tutorial.html
# The data set used in this example is from http://archive.ics.uci.edu/ml/datasets/Wine+Quality
# P. Cortez, A. Cerdeira, F. Almeida, T. Matos and J. Reis.
# Modeling wine preferences by data mining from physicochemical properties. In Decision Support Systems, Elsevier, 47(4):547-553, 2009.
import os
import warnings
import sys
import pandas as pd
#All credits to https://youtu.be/34cqrIp5ANg, Customized and simplified it for my reference
import json
from fastapi import FastAPI, HTTPException
import os
app = FastAPI()
BOOKS_FILE = "books.json"
BOOK_DATABASE = ['The great gatsby','atomic habits','norwegien wood']
if os.path.exists(BOOKS_FILE):
Error #1
Error - cannot import name '_validate_lengths'
Link - https://github.com/numpy/numpy/issues/12744
Resolution - conda install -c conda-forge scikit-image
Error #2
Disable Windows 10 HVCI Mode
https://docs.microsoft.com/en-us/windows/security/threat-protection/device-guard/enable-virtualization-based-protection-of-code-integrity
Deploying Your First Docker Container
https://katacoda.com/courses/docker/deploying-first-container
#https://github.com/vlazovskiy/predicting-instacart-purchases/blob/master/logistic_regression_models.ipynb
#Rewrite Everything in TSQL
#Build Model
#Submit Report
#Save and Restore Data Frame
import pandas as pd
import numpy as np
from collections import OrderedDict
#Versions check - Python
import sys
print("python environment " + str(sys.version_info))
#OpenCV version
import cv2
print("OpenCV version " + str(cv2.__version__))
#Tensorflow version
import tensorflow as tf
#Credits - https://github.com/hunkim/PyTorchZeroToAll/blob/master/05_linear_regression.py
import torch
from torch.autograd import Variable
x_data = Variable(torch.Tensor([[1.0],[2.0],[3.0]]))
y_data = Variable(torch.Tensor(([2.0],[4.0],[6.0])))
class Model(torch.nn.Module):
def __init__(self):
0.0 0.0 0.0
0.1 0.1 0.1
0.2 0.2 0.2
9.0 9.0 9.0
9.1 9.1 9.1
9.2 9.2 9.2
#https://lmcaraig.com/image-histograms-histograms-equalization-and-histograms-comparison/
def rgbequalized(imagefilePath):
imageoriginal = cv2.imread(imagefilePath,1)
image = cv2.resize(imageoriginal, (24, 24), interpolation = cv2.INTER_AREA)
b,g,r = cv2.split(image)
b_data = cv2.equalizeHist(b)
bf_data = b_data.flatten()
bflatdata = bf_data.astype(np.float32)
bfeaturedata = (bflatdata - np.min(bflatdata)) / (np.max(bflatdata) - np.min(bflatdata)) * 2 - 1
@siva2k16
siva2k16 / mmds-q2a.R
Created November 7, 2016 10:14 — forked from primaryobjects/mmds-q2a.R
Mining Massive Datasets Quiz 2a: LSH (Basic)
#
# Quiz 2a
#
#
# Q1
# The edit distance is the minimum number of character insertions and character deletions required to turn one string into another. Compute the edit distance between each pair of the strings he, she, his, and hers. Then, identify which of the following is a true statement about the number of pairs at a certain edit distance.
#
packages <- c('combinat', 'stringdist')