This file contains hidden or 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 generate_plot(data, title=None): | |
source = ColumnDataSource(data=data) | |
p = Scatter(data, x='x', y='y', xlabel='x', ylabel='y', width=400, height=400, title=title) | |
line = Line_glyph(x='x', y='y_pred', line_color='blue') | |
p.add_glyph(source, line) | |
return p | |
def lasso_regression(data, predictors, alpha=None): | |
# Fit the model |
This file contains hidden or 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
new_x = 15 | |
data_x = np.array([new_x**i for i in range(0,13)]) | |
new_y = 4*new_x+1+np.random.normal(0, 5, 1) | |
idx = 0 | |
for degree in [1, 2, 4, 6, 8, 10]: | |
y_pred = models[idx].predict(data_x[0:degree+1].reshape(1,-1)) | |
rss = (y_pred-new_y)**2 | |
idx += 1 | |
print "The residual error for X={} is {}".format(new_x, rss) |
This file contains hidden or 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
np.random.seed(10) | |
x_1=np.linspace(0,10,11) | |
x_0=np.ones(len(x_1)) | |
y=4*x+1+np.random.normal(0, 5, len(x_1)) | |
data = pd.DataFrame(np.column_stack([x_0,x_1,y]),columns=['x_0','x_1','y']) | |
predictors=['x_0','x_1'] | |
predictors.extend(['x_{}'.format(i) for i in range(2,13)]) | |
for i in range(2,13): | |
data['x_{}'.format(i)] = data['x_1']**i |
This file contains hidden or 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
# General | |
import numpy as np | |
import pandas as pd | |
# Charting | |
from bokeh.plotting import figure | |
from bokeh.models import ColumnDataSource | |
from bokeh.io import output_notebook | |
# Regression | |
from sklearn.linear_model import LinearRegression |
This file contains hidden or 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 aws_cdk.core import Stack, Construct, RemovalPolicy, Duration | |
import aws_cdk.aws_iam as iam | |
import aws_cdk.aws_sqs as sqs | |
import aws_cdk.aws_cloudwatch as cw | |
import aws_cdk.aws_ec2 as ec2 | |
import aws_cdk.aws_autoscaling as autoscaling | |
from aws_cdk.aws_cloudwatch_actions import AutoScalingAction | |
vpc_id = "vpc-0123456789abc" |
This file contains hidden or 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 aws_cdk import core | |
from my_stack import MyCdkStack | |
env_dev = core.Environment(account="123456789", region="ca-central-1") | |
app = core.App() | |
DsptCdkStack(app, "MyCdkStack", env=env_dev) | |
app.synth() |
This file contains hidden or 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
version: 0.2 | |
phases: | |
install: | |
runtime-versions: | |
python: 3.8 | |
pre_build: | |
commands: | |
- apt-get install -y python3-venv | |
- python3.6 -m venv test_venv |
This file contains hidden or 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
{ | |
"name": "Dummy_Project-CI-coverage", | |
"type": "TEST", | |
"exportConfig": { | |
"exportConfigType": "S3", | |
"s3Destination": { | |
"bucket": "my_s3_test_report_bucket", | |
"path": "coverage", | |
"packaging": "NONE" | |
} |
This file contains hidden or 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
{ | |
"name": "Dummy_project-CI-report", | |
"type": "TEST", | |
"exportConfig": { | |
"exportConfigType": "S3", | |
"s3Destination": { | |
"bucket": "my_s3_test_report_bucket", | |
"path": "report", | |
"packaging": "NONE" | |
} |
This file contains hidden or 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
#! /bin/bash | |
PROJECT_NAME="Dummy_Project-CI" | |
function usage { | |
echo "usage: codebuild.sh buil|run|clean [options]" | |
echo "build:" | |
echo " Build the project and corresponding report groups" | |
echo "run:" | |
echo " Run the tests" | |
echo " Run Options:" |