Note: the commands were tested on Postgres 9.5.4
Connect with the user USER_NAME
psql -h REMOTE_SERVER_ADDRESS -U USER_NAME
from sklearn import metrics | |
def get_classification_as_df(y_test: list, y_pred: list, sort_by: list =[])-> pd.DataFrame: | |
''' Get the classification report as a DataFrame''' | |
report = metrics.classification_report(y_test, y_pred, output_dict=True) | |
df_classification_report = pd.DataFrame(report).transpose() | |
df_classification_report = df_classification_report.sort_values( | |
by=sort_by, ascending=False) | |
return df_classification_report |
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
The script will explain what changes it will make and prompt you before the installation begins. Once you’ve installed Homebrew, insert the Homebrew directory at the top of your PATH environment variable. You can do this by adding the following line at the bottom of your ~/.bash_profile
file
export PATH=/usr/local/bin:/usr/local/sbin:$PATH
# A simple cheat sheet of Spark Dataframe syntax | |
# Current for Spark 1.6.1 | |
# import statements | |
from pyspark.sql import SQLContext | |
from pyspark.sql.types import * | |
from pyspark.sql.functions import * | |
#creating dataframes | |
df = sqlContext.createDataFrame([(1, 4), (2, 5), (3, 6)], ["A", "B"]) # from manual data |
from sqlalchemy.ext.declarative import declarative_base | |
from sqlalchemy import Integer, Column | |
from postgresql_json import JSON | |
Base = declarative_base() | |
class Document(Base): | |
id = Column(Integer(), primary_key=True) | |
data = Column(JSON) | |
#do whatever other work |
import contextlib | |
import os | |
import tempfile | |
half_lambda_memory = 10**6 * ( | |
int(os.getenv('AWS_LAMBDA_FUNCITON_MEMORY_SIZE', '0')) / 2) | |
@contextlib.contextmanager |
--- | |
AWSTemplateFormatVersion: '2010-09-09' | |
Description: Simple S3 Bucket with SNS Trigger | |
Parameters: | |
BucketName: | |
Type: String | |
Description: The name of the S3 Bucket to create |
#!/bin/bash | |
set -e | |
docker run -dit --rm --name test tensorflow/tensorflow:latest-gpu-py3-jupyter | |
TF_VERSION=`docker exec -it test bash -c "pip freeze | grep tensorflow-gpu | cut -d'=' -f3"` | |
TF_VERSION=`echo $TF_VERSION | tr -d '\r'` | |
docker stop test |