Skip to content

Instantly share code, notes, and snippets.

View Raj067's full-sized avatar
🏠
Working from home

Rajabu Mrisho Raj067

🏠
Working from home
View GitHub Profile
import React, { Component } from "react";
import instance from "../axiosInstanceReact";
class Home extends Component {
constructor(props) {
super(props);
this.state = {};
}
async componentDidMount() {
import numpy as np
from sklearn.cluster import DBSCAN
from sklearn import metrics
from sklearn.datasets.samples_generator import make_blobs
from sklearn.preprocessing import StandardScaler
centers = [[1, 1], [-1, -1], [1, -1]]
X, labels_true = make_blobs(n_samples=750, centers=centers, cluster_std=0.4,
random_state=0)
X = StandardScaler().fit_transform(X)
from sklearn.neighbors.nearest_centroid import NearestCentroid
import numpy as np
X = np.array([[-1, -1], [-2, -1], [-3, -2], [1, 1], [2, 1], [3, 2]])
y = np.array([1, 1, 1, 2, 2, 2])
clf = NearestCentroid()
clf.fit(X, y)
print(clf.predict([[-0.8, -1]]))
import time
import math
def time_since(val: str) -> str:
'''Returning since time'''
sec = math.floor(time.time() - float(val))
interval = sec // 31536000
if interval > 1:
return f'{math.floor(interval)} years ago'
def arithmetic_arranger(data, cond=False):
if len(data) > 5:
raise ValueError('Too many problems')
req = ''
req1 = ''
req2 = ''
req3 = ''