Skip to content

Instantly share code, notes, and snippets.

Or Hiltch orcaman

  • skyline.ai
  • Tel Aviv, Israel
Block or report user

Report or block orcaman

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@orcaman
orcaman / gather.go
Created Mar 8, 2020
CloudFunction to gather multiple GET requests
View gather.go
package p
import (
"encoding/json"
"fmt"
"io/ioutil"
"log"
"net/http"
"strings"
"sync"
View test.json
{
"reviews": [
{
"author_name": "****",
"author_url": "https://www.google.com/maps/contrib/****/reviews",
"language": "en",
"profile_photo_url": "https://lh6.ggpht.com/-******/AAAAAAAAAAI/AAAAAAAAAAA/YiZVkgB0bOI/s128-c0x00000000-cc-rp-mo/photo.jpg",
"rating": 1,
"relative_time_description": "3 months ago",
"text": "Haha. I can’t even believe you guys are sending this. I’m not even really sure where to start. But, I’ve lived in apartments all over the country. Probably 10 in total. This apartment complex was the worst by a mile. Everything about it was bad. The staff, the grounds, the units, everything. I wouldn’t come back and live her if you guys payed me to live here.",
@orcaman
orcaman / main.go
Created Jul 29, 2019
Redirecting Docker Logs Driver to GCP StackDriver Logs
View main.go
ctx := context.Background()
cli, err := client.NewClientWithOpts(client.FromEnv, client.WithAPIVersionNegotiation())
if err != nil {
return err
}
resp, err := cli.ContainerCreate(ctx, &container.Config{
Image: image,
Env: env,
Tty: true,
View iris.csv
sepal_length sepal_width petal_length petal_width species
5.1 3.5 1.4 0.2 setosa
4.9 3.0 1.4 0.2 setosa
4.7 3.2 1.3 0.2 setosa
4.6 3.1 1.5 0.2 setosa
5.0 3.6 1.4 0.2 setosa
5.4 3.9 1.7 0.4 setosa
4.6 3.4 1.4 0.3 setosa
5.0 3.4 1.5 0.2 setosa
4.4 2.9 1.4 0.2 setosa
View gmmroc.py
# results on training set
y_pred = xgb_test.predict(dtrain, ntree_limit=xgb_test.best_iteration+1)
y_true = train_df['class'].values
print(roc_auc(y_pred, dtrain))
# results on test set
y_pred = xgb_test.predict(dtest, ntree_limit=xgb_test.best_iteration+1)
y_true = test_df['class'].values
print(roc_auc(y_pred, dtest))
@orcaman
orcaman / gmm_xgb_test.predict.py
Created Jul 22, 2019
gmm_xgb_test.predict.py
View gmm_xgb_test.predict.py
dsyn = xgb.DMatrix(syn[X_col], syn[y_col], feature_names=X_col)
y_pred = xgb_test.predict(dsyn, ntree_limit=xgb_test.best_iteration+1)
y_true = syn['class'].values
print(recall(y_pred, dsyn))
print(precision(y_pred, dsyn))
View gmm.sample.py
t1 = gmm.sample(len(real_data))
data_new = t1[0]
points_new = pca.inverse_transform(data_new)
syn = pd.DataFrame(points_new, columns=list(real_data))
View gmm.py
gmm = GaussianMixture(20, covariance_type='full', random_state=0)
gmm.fit(data)
t1 = gmm.sample(len(data_real))
data_new = t1[0]
points_new = pca.inverse_transform(data_new)
df_fake = pd.DataFrame(points_new, columns=list(data_real)[:-2])
View pca.py
from sklearn.decomposition import PCA
pca = PCA(0.99, whiten=True)
data = pca.fit_transform(df_real)
View find_components.py
n_components = np.arange(5, 30, 5)
models = [GaussianMixture(n, covariance_type='full', random_state=0)
for n in n_components]
aics = [model.fit(data).aic(data) for model in models]
plt.plot(n_components, aics)
plt.show()
You can’t perform that action at this time.