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
# Preliminary investigation | |
# Shape of training data (num_rows, num_columns) | |
print(X_train.shape) | |
# Number of missing values in each column of training data | |
missing_val_count_by_column = (X_train.isnull().sum()) | |
print(missing_val_count_by_column[missing_val_count_by_column > 0]) | |
# Result | |
''' |
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
# Source: https://jakevdp.github.io/PythonDataScienceHandbook/05.08-random-forests.html | |
# | |
def visualize_classifier(model, X, y, ax=None, cmap='rainbow'): | |
ax = ax or plt.gca() | |
# Plot the training points | |
ax.scatter(X[:, 0], X[:, 1], c=y, s=30, cmap=cmap, | |
clim=(y.min(), y.max()), zorder=3) | |
ax.axis('tight') | |
ax.axis('off') |
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
# Typical / useful include | |
import numpy as np | |
import pandas as pd | |
import matplotlib.pyplot as plt | |
import seaborn as sns | |
import pandas_profiling as pp | |
import plotly.express as px | |
import plotly.graph_objs as go | |
from plotly.offline import iplot | |
import plotly.express as px |
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
import numpy as np; | |
import pandas as pd | |
import matplotlib.pyplot as plt | |
np.random.seed(42) | |
# df from np.ndarray | |
df = pd.DataFrame(data = np.random.random(size=(4,4))*100, columns = ['A','B','C','D']) | |
df.plot(kind='box') | |
plt.show() |
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
import numpy as np | |
positions = ['GK', 'M', 'A', 'D'] | |
heights = [191, 184, 185, 180] | |
# Convert positions and heights to numpy arrays: np_positions, np_heights | |
np_heights = np.array(heights) | |
np_positions = np.array(positions) | |
# Heights of the goalkeepers: gk_heights |
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
--- | |
Parameters: | |
ipBlockParam: | |
Description: IP cidr block for VPC | |
Default: "172.16.0.0/16" | |
Type: String | |
MinLength: '9' | |
MaxLength: '18' | |
AllowedPattern: '(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})/(\d{1,2})' | |
ConstraintDescription: must be a valid IP CIDR range of the form x.x.x.x/x. |
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
# Source: https://github.com/terraform-providers/terraform-provider-aws/blob/master/examples/eks-getting-started/workstation-external-ip.tf | |
# | |
# Workstation External IP | |
# | |
# This configuration is not required and is | |
# only provided as an example to easily fetch | |
# the external IP of your local workstation to | |
# configure inbound EC2 Security Group access | |
# to the Kubernetes cluster. | |
# |
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
terraform { | |
required_providers { | |
aws = { | |
source = "hashicorp/aws" | |
version = ">= 4.6" # v3.38.0 minimal version to use default tags | |
} | |
} | |
} | |
provider "aws" { |
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
data "aws_ami" "amazon_linux2_kernel_5" { | |
most_recent = true | |
owners = ["amazon"] | |
filter { | |
name = "name" | |
values = ["amzn2-ami-kernel-5.10-hvm-2.0*x86_64-gp2"] | |
} | |
filter { |
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
## Assume aws_instance resource called "flask1" | |
output "public_ip" { | |
description = "Public IP of instance" | |
value = aws_instance.flask1.public_ip | |
} | |
output "key_name" { | |
description = "SSH Key Name" | |
value = aws_instance.flask1.key_name |
OlderNewer