This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function sum(num) { | |
return function(b) { | |
if (b) { | |
return sum(num+b); | |
} else { | |
return num; | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// generating questions of some complexity for kids math | |
// ["5 + 3 =", "3 + 2 =", "0 + 3 =", "2 + 0 =", "1 + 2 ="] | |
function generateRandomInteger(complexity) { | |
return Math.floor(Math.random() * complexity); | |
} | |
function matchingPairs(complexity) { | |
const x = generateRandomInteger(complexity); | |
const y = generateRandomInteger(complexity); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// generating questions of some complexity for kids math | |
// ["8 + 8 =", "8 + 5 =", "6 + 5 =", "3 + 9 =", "4 + 8 ="] | |
function generateRandomInteger(complexity) { | |
return Math.floor(Math.random() * complexity); | |
} | |
function matchingPairs(complexity) { | |
const x = generateRandomInteger(complexity); | |
const y = generateRandomInteger(complexity); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const profile = { | |
name: "Madasaamy", | |
age: 80, | |
kids: [ | |
{ | |
name: "Soori", | |
age: 57, | |
kids: [ | |
{ | |
name: "Miller", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
console.log('Hello World Brother') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
dataset = pd.read_csv("data.csv", header=None) | |
# apriori expects the input as list of list | |
# [ [item1, item2], [item2, item3, item4], ..... ] ] | |
transactions = [] | |
for i in range(0, len(dataset)): | |
transactions.append([str(dataset.values[i, j]) for j in range(0, 20)]) | |
from apyori import apriori |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
import matplotlib.pyplot as plt | |
data = pd.read_csv('Data.csv') | |
X = data.iloc[:, 1:3] | |
# use elbow mwthod to find optimal number of clusters | |
from sklearn.cluster import KMeans | |
''' | |
wcss = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#plot the scatters | |
''' | |
X[y_pred==0] - will list records which belongs to cluster 0 | |
output: | |
Qty UnitPrice | |
1 1911 3.39 | |
''' | |
plt.scatter(X[y_pred == 0].iloc[:, 0], X[y_pred == 0].iloc[:, 1], s=5, c="red") | |
plt.scatter(X[y_pred == 1].iloc[:, 0], X[y_pred == 1].iloc[:, 1], s=5, c="green") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
kmeans = KMeans(n_clusters=4, init="k-means++", max_iter=1000, n_init=10) | |
y_pred = kmeans.fit_predict(X) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
X = data.iloc[:, 1:3] | |
# use elbow mwthod to find optimal number of clusters | |
from sklearn.cluster import KMeans | |
# with in cluster sum of squares | |
wcss = [] | |
for i in range(1, 11): | |
kmeans = KMeans(n_clusters =i, init="k-means++", max_iter=300, n_init=10) | |
kmeans.fit(X) |
NewerOlder