Skip to content

Instantly share code, notes, and snippets.

from typing import List, Dict, Tuple
x: int = 10
y: float = 0.8
string: str = 'I am a string'
hash_map: Dict[str, int] = {}
List1: List[int] = []
my_tuple: Tuple[str, int] = ()
import numpy as np
import pandas as pd
from sklearn.datasets import make_blobs
from sklearn.base import BaseEstimator, TransformerMixin
from sklearn.preprocessing import StandardScaler
from sklearn.pipeline import Pipeline
from sklearn.linear_model import LogisticRegression
class CustomImputer(BaseEstimator, TransformerMixin):
import numpy as np
import pandas as pd
from typing import Dict, List
from sklearn.datasets import make_blobs
from sklearn.base import BaseEstimator, TransformerMixin
from sklearn.preprocessing import StandardScaler
from sklearn.pipeline import Pipeline
from sklearn.linear_model import LogisticRegression
import apache_beam as beam
from apache_beam.options.pipeline_options import PipelineOptions
from google.cloud import bigquery
import re
import logging
import sys
PROJECT='user-logs-237110'
schema = 'remote_addr:STRING, timelocal:STRING, request_type:STRING, status:STRING, body_bytes_sent:STRING, http_referer:STRING, http_user_agent:STRING'
from apache_beam.options.pipeline_options import PipelineOptions
from google.cloud import pubsub_v1
from google.cloud import bigquery
import apache_beam as beam
import logging
import argparse
import sys
import re
from faker import Faker
import time
import random
import os
import numpy as np
from datetime import datetime, timedelta
LINE = """\
from stream_logs import generate_log_line
import logging
from google.cloud import pubsub_v1
import random
import time
PROJECT_ID="user-logs-237110"
TOPIC = "userlogs"
def predict(self, X):
"""Returns predicted labels using Bayes Rule to
Calculate the posterior distribution
Parameters:
-------------
X: N*d numpy array
Returns:
----------
@DFoly
DFoly / fit.py
Last active March 7, 2019 12:12
def fit(self, X):
"""Compute the E-step and M-step and
Calculates the lowerbound
Parameters:
-----------
X: (N x d), data
Returns:
----------
def _compute_loss_function(self, X, pi, mu, sigma):
"""Computes lower bound loss function
Parameters:
-----------
X: (N x d), data
Returns:
---------
pi: (C)