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
from sklearn.metrics import recall_score, precision_score, roc_auc_score | |
def recall(preds, dtrain): | |
labels = dtrain.get_label() | |
return 'recall', recall_score(labels, np.round(preds)) | |
def precision(preds, dtrain): | |
labels = dtrain.get_label() | |
return 'precision', precision_score(labels, np.round(preds)) |
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
for _, d := range p.DatasetDescriptors { | |
for _, t := range d.TableDescriptors { | |
wg.Add(1) | |
go func(d *datasetDescriptor, t *tableDescriptor) { | |
rl.Take() | |
defer wg.Done() | |
schemaPath := *backupPath + "/" + d.Name + "/" + t.Name + "/schema.json" | |
if fileExists(ctx, schemaPath, bkt) { | |
return |
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
go func() { | |
wg.Wait() | |
donec <- true | |
}() | |
errorCount := 0 | |
for { | |
select { | |
case err := <-errc: | |
if errorCount >= *maxErrors { |
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
WITH | |
Distances AS ( | |
SELECT | |
DISTINCT ML.CENTROID_ID, | |
sepal_length, | |
sepal_width, | |
petal_length, | |
petal_width, | |
species, | |
MIN(NEAREST_CENTROIDS_DISTANCE.DISTANCE) AS distance_from_closest_centroid |
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
Threshold AS ( | |
SELECT | |
ROUND(APPROX_QUANTILES(distance_from_closest_centroid,10000)[ | |
OFFSET | |
(9500)],2) AS threshold | |
FROM | |
Distances) |
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
WITH | |
Distances AS ( | |
SELECT | |
DISTINCT ML.CENTROID_ID, | |
sepal_length, | |
sepal_width, | |
petal_length, | |
petal_width, | |
species, | |
MIN(NEAREST_CENTROIDS_DISTANCE.DISTANCE) AS distance_from_closest_centroid |
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
CREATE OR REPLACE MODEL | |
public.iris_clusters | |
OPTIONS | |
(model_type='kmeans', | |
num_clusters=4, | |
standardize_features = TRUE) AS | |
SELECT | |
DISTINCT sepal_length, | |
sepal_width, | |
petal_length, |
We can't make this file beautiful and searchable because it's too large.
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
StationNumber,Lat,Lon,Address,State,City,County,Zip | |
690014,32.350000,-106.367000,"Unnamed Road, Chaparral, NM 88081, USA",NM,Chaparral,Otero County,88081 | |
690070,36.683000,-121.767000,"721 Neeson Rd, Marina, CA 93933, USA",CA,Marina,Monterey County,93933 | |
690020,36.000000,-121.233000,"7th Division Rd, Jolon, CA 93928, USA",CA,Jolon,Monterey County,93928 | |
690020,36.000000,-121.233000,"7th Division Rd, Jolon, CA 93928, USA",CA,Jolon,Monterey County,93928 | |
690110,42.608000,-82.835000,"Selfridge Angb Airport, Harrison Charter Township, MI 48045, USA",MI,Harrison charter Township,Macomb County,48045 | |
690140,33.667000,-117.733000,"8065 Marine Way, Irvine, CA 92618, USA",CA,Irvine,Orange County,92618 | |
690150,34.300000,-116.167000,"Rainbow Canyon Road, Twentynine Palms, CA 92277, USA",CA,Twentynine Palms,San Bernardino County,92277 | |
690169,33.700000,-117.830000,"2437 Park Ave, Tustin, CA 92782, USA",CA,Tustin,Orange County,92782 | |
690174,36.533000,-115.567000,"US-95, Nevada, USA",NV,,Clark County, |
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
package main | |
import ( | |
"context" | |
"encoding/csv" | |
"fmt" | |
"log" | |
"os" | |
"sync" | |
"time" |
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
#standardSQL | |
SELECT | |
EXTRACT(year | |
FROM | |
o.day) AS year, | |
EXTRACT(month | |
FROM | |
o.day) AS month, | |
SUM(o.output_satoshis) * 0.00000001 AS btc | |
FROM ( |