Skip to content

Instantly share code, notes, and snippets.

View vishivish18's full-sized avatar
🤺
2.0

Vishal Ranjan vishivish18

🤺
2.0
View GitHub Profile
@vishivish18
vishivish18 / mlop_session_vi-working-copy.ipynb
Created January 7, 2022 10:19
MLOP_Session_VI-Working Copy.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@vishivish18
vishivish18 / pre-commit-eslint
Created April 29, 2020 17:43 — forked from shettayyy/pre-commit-eslint
Pre-commit hook for Linting JS with ESLint before commit.
#!/bin/sh
STAGED_FILES=$(git diff --cached --name-only --diff-filter=ACM | grep ".jsx\{0,1\}$")
ESLINT="$(git rev-parse --show-toplevel)/node_modules/.bin/eslint"
if [[ "$STAGED_FILES" = "" ]]; then
exit 0
fi
PASS=true
var wizard = {
schoolName: 'Hogwarts',
headMaster: 'Professor Dumbeldore ',
getWizardName: function(firstname, lastname) {
var fullname = firstname + ' ' + lastname;
return fullname;
},
getSchoolNameAndHeadMaster: function(){
return this.headMaster + " will be your headMaster at "+ this.schoolName
}
@vishivish18
vishivish18 / gsmkdirs.sh
Created September 22, 2018 09:41 — forked from xmedeko/gsmkdirs.sh
Google Cloud Bucket: create explicit dirs
#!/bin/bash
##
## Creates explicit dirs on the bucket
##
function print_help() {
echo "Usage:" $(basename $0) bucket_mounted_dir
exit 1
}
$scope.registerWithFacebook = function() {
FB.getLoginStatus(function(response) {
if (response.status === 'connected') {
console.log("Here")
// Logged into your app and Facebook.
$scope.testAPI();
} else {
// The person is not logged into your app or we are unable to tell.
document.getElementById('status').innerHTML = 'Please log ' +
'into this app.';
from scipy.spatial import distance
def euc(a,b):
return distance.euclidean(a,b)
class BareBonesKNN():
def fit(self, x_train, y_train):
self.x_train = x_train
self.y_train = y_train
pass
import numpy as np
from sklearn.datasets import load_iris
from sklearn import tree
iris = load_iris()
test_idx = [0, 50, 100]
#training data
train_target = np.delete(iris.target, test_idx)
from sklearn.datasets import load_iris
iris = load_iris()
print (iris.feature_names)
print (iris.target_names)
print (iris.data[0])
print (iris.target[0])
for i in range(len(iris.target)):
print ("Example %d: label %s, features %s" % (i, iris.target[i],iris.data[i]))
from sklearn import tree
features = [[140, "smooth"], [130, "smooth"], [150, "bumpy"], [170, "bumpy"]]
labels = ["apple", "apple", "orange", "orange"]
clf = tree.DecisionTreeClassifier()
clf = clf.fit(features, labels)
from sklearn import tree
#import sklearn
# features = [[140, "smooth"], [130, "smooth"], [150, "bumpy"], [170, "bumpy"]]
# labels = ["apple", "apple", "orange", "orange"]
features = [[140, "1"], [130, "1"], [150, "0"], [170, "0"]]
labels = ["0", "0", "1", "1"]
clf = tree.DecisionTreeClassifier()
clf = clf.fit(features, labels)