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
comparing metrics from 2023-09-20T15:56:11Z to 2023-09-20T16:06:11Z | |
[search-xkgallatin0revert-13428-rever, 923 series] | |
debug: http://prometheus.search-infra.etsy-searchinfra-gke-dev.etsycloud.com/api/v1/series?match%5B%5D=%7Bnamespace%3D%22search-xkgallatin0revert-13428-rever%22,service%3D%22mmx-recsys-service%22%7D&start=2023-09-20T15:56:11Z&end=2023-09-20T16:06:11Z | |
[search-xkgallatin1main, 913 series] | |
debug: http://prometheus.search-infra.etsy-searchinfra-gke-dev.etsycloud.com/api/v1/series?match%5B%5D=%7Bnamespace%3D%22search-xkgallatin1main%22,service%3D%22mmx-recsys-service%22%7D&start=2023-09-20T15:56:11Z&end=2023-09-20T16:06:11Z | |
command: git diff --no-index /tmp/search-xkgallatin0revert-13428-rever-14651925583344607341.tmp /tmp/search-xkgallatin1main-16647560124810188357.tmp |
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
comparing metrics from 2023-09-20T15:52:48Z to 2023-09-20T16:02:48Z | |
[search-xkgallatin0revert-13428-rever, 851 series] | |
debug: http://prometheus.search-infra.etsy-searchinfra-gke-dev.etsycloud.com/api/v1/series?match%5B%5D=%7Bnamespace%3D%22search-xkgallatin0revert-13428-rever%22,service%3D%22mmx-recsys-service%22%7D&start=2023-09-20T15:52:48Z&end=2023-09-20T16:02:48Z | |
[search-xkgallatin1main, 840 series] | |
debug: http://prometheus.search-infra.etsy-searchinfra-gke-dev.etsycloud.com/api/v1/series?match%5B%5D=%7Bnamespace%3D%22search-xkgallatin1main%22,service%3D%22mmx-recsys-service%22%7D&start=2023-09-20T15:52:48Z&end=2023-09-20T16:02:48Z | |
command: git diff --no-index /tmp/search-xkgallatin0revert-13428-rever-17960227474054244828.tmp /tmp/search-xkgallatin1main-6809842399054133810.tmp |
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
comparing metrics from 2023-09-20T15:12:57Z to 2023-09-20T15:22:57Z | |
[search-xkgallatin0revert-13428-rever, 883 series] | |
debug: http://prometheus.search-infra.etsy-searchinfra-gke-dev.etsycloud.com/api/v1/label/__name__/values?match%5B%5D=%7Bnamespace%3D%22search-xkgallatin0revert-13428-rever%22,service%3D%22mmx-recsys-service%22%7D&start=2023-09-20T15:12:57Z&end=2023-09-20T15:22:57Z | |
[search-xkgallatin1main, 883 series] | |
debug: http://prometheus.search-infra.etsy-searchinfra-gke-dev.etsycloud.com/api/v1/label/__name__/values?match%5B%5D=%7Bnamespace%3D%22search-xkgallatin1main%22,service%3D%22mmx-recsys-service%22%7D&start=2023-09-20T15:12:57Z&end=2023-09-20T15:22:57Z | |
command: git diff --no-index /tmp/search-xkgallatin0revert-13428-rever-2840922538639804395.tmp /tmp/search-xkgallatin1main-12456199614687710159.tmp |
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 sys | |
import grpc | |
def get_grpc_connection(host_port: str, secure: bool): | |
if secure: | |
credentials = grpc.ssl_channel_credentials() | |
channel = grpc.secure_channel(host_port, credentials) | |
else: | |
channel = grpc.insecure_channel(host_port) | |
return channel |
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 river import linear_model, compose, preprocessing, metrics | |
# create logistic regression model with a standard scaler | |
model = compose.Pipeline( | |
preprocessing.StandardScaler(), | |
linear_model.LogisticRegression() | |
) | |
# use ROCAUC to evaluate our model | |
metric = metrics.ROCAUC() |
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 pickle | |
from sklearn.datasets import make_classification | |
from sklearn.linear_model import LogisticRegression | |
x, y = make_classification(n_samples=100, | |
n_features=3, | |
n_informative=2, | |
n_classes=2, | |
n_redundant=0, | |
n_repeated=0,) |
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 mlflow | |
import mlflow.sklearn | |
from sklearn.ensemble import RandomForestRegressor | |
from sklearn.metrics import mean_squared_error | |
from sklearn.model_selection import train_test_split | |
from sklearn import datasets | |
# uncomment portion below if using a remote mlflow instance | |
# mlflow.set_tracking_uri("http://your-server:5000") | |
mlflow.set_experiment("iris") # creates an experiment if it doesn't exist |
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 typing import Iterable, Callable, Dict | |
class SuperSimpleFeatureStore: | |
def __init__(self, dataframe: pd.DataFrame): | |
self.dataframe = dataframe | |
self.feature_dict = dataframe.set_index("user_id").T.to_dict() | |
def register_feature(self, name: str, feature_definition: Callable) -> None: | |
for key in self.feature_dict: |
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 time | |
class PerformanceMonitor: | |
def __init__(self): | |
self.inference_times = [] | |
def record(self, prediction_time: float) -> None: | |
self.inference_times.append(prediction_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
def load_latest_model() -> sklearn.pipeline.Pipeline: | |
latest_model_path = pd.read_csv("metadata_store.csv").query("timestamp == timestamp.max()")["model_path"].values[0] | |
loaded_model = joblib.load(latest_model_path) | |
return loaded_model | |
def model_predict(user_id: str) -> float: | |
model = load_latest_model() | |
features = feature_store.get_user_feature(user_id) | |
return model.predict([[v for k,v in features.items() if k != "target"]]) |
NewerOlder