Unnamed: 0 int64 0 16k | text_prompt stringlengths 110 62.1k | code_prompt stringlengths 37 152k |
|---|---|---|
7,000 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Data Science Glossary on Kaggle
Kaggle is the place to do data science projects. There are so many algorithms and concepts to learn. Kaggle Kernels are one of the best resources on internet ... | Python Code:
tokens = ["linear regression"]
best_kernels(tokens, 10)
tokens = ['logistic regression', "logistic"]
best_kernels(tokens, 10)
Explanation: Data Science Glossary on Kaggle
Kaggle is the place to do data science projects. There are so many algorithms and concepts to learn. Kaggle Kernels are one of the best ... |
7,001 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Accompanying code examples of the book "Introduction to Artificial Neural Networks and Deep Learning
Step1: Preparing the Dataset
Load dataset from tab-seperated text file
Dataset contains ... | Python Code:
%load_ext watermark
%watermark -a 'Sebastian Raschka' -d -p tensorflow,numpy,matplotlib
%matplotlib inline
import tensorflow as tf
import numpy as np
import os
import matplotlib.pyplot as plt
Explanation: Accompanying code examples of the book "Introduction to Artificial Neural Networks and Deep Learning: ... |
7,002 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
<img class="logo" src="images/python-logo.png" height=100 align='right'/>
Python
High-level
General purpose
Multiple programming paradigms
Interpreted
Variables
Step1: Containers
Data types... | Python Code:
var1 = 1 # interger
var2 = 2.34 # floating point numbers
var3 = 5.6 + 7.8j # complex numbers
var4 = "Hello World" # strings
var5 = True # booleans
var6 = None # special value to indicate the absence of a value
print("var1 value:", var1, "type:", type(var1))
... |
7,003 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
COSC Learning Lab
01_device_control.py
Related Scripts
Step1: Implementation
Step2: Execution
Step3: HTTP | Python Code:
help('learning_lab.01_device_control')
Explanation: COSC Learning Lab
01_device_control.py
Related Scripts:
* 03_management_interface.py
Table of Contents
Table of Contents
Documentation
Implementation
Execution
HTTP
Documentation
End of explanation
from importlib import import_module
script = import_modul... |
7,004 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Read and plot data
The file ex1data1.csv contains dataset
first column is population in a city ;
second column is the profit in that city
Step1: Object for linear regression is to minimize... | Python Code:
import csv
import pandas as pd
import numpy as np
from numpy import genfromtxt
data = pd.read_csv('./ex1data1.csv', delimiter=',',
names=['population','profit'])
data.head()
%matplotlib inline
'''
import matplotlib.pyplot as plt
x= data['population']
y= data['profit']
plt.plot(x,y,'rx')
... |
7,005 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Object Detection Demo
Welcome to the object detection inference walkthrough! This notebook will walk you step by step through the process of using a pre-trained model to detect objects in a... | Python Code:
import numpy as np
import os
import pickle
import six.moves.urllib as urllib
import sys
sys.path.append("..")
import tarfile
import tensorflow as tf
import zipfile
from object_detection.eval_util import evaluate_detection_results_pascal_voc
from collections import defaultdict
from io import StringIO
from m... |
7,006 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Filtering and Annotation Tutorial
Filter
You can filter the rows of a table with Table.filter. This returns a table of those rows for which the expression evaluates to True.
Step1: We can... | Python Code:
import hail as hl
hl.utils.get_movie_lens('data/')
users = hl.read_table('data/users.ht')
users.filter(users.occupation == 'programmer').count()
Explanation: Filtering and Annotation Tutorial
Filter
You can filter the rows of a table with Table.filter. This returns a table of those rows for which the exp... |
7,007 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
I am looking to work out how to handle Bayesian estimation in a rate counting system.
Model
Foreground data we want is Binomial with trials 100 and probability 0.5, the number of samples wi... | Python Code:
samples = tb.logspace(1, 10000, 10)
fore = [np.random.binomial(100, 0.50, size=v) for v in samples]
print(tb.logspace(1, 1000, 10))
for v in fore[::-1]:
h = np.histogram(v, 20)
plt.hist(v, 20, label='{0}'.format(np.floor(len(v))))
plt.yscale('log')
plt.legend(bbox_to_anchor=(1.05, 1), loc=2, border... |
7,008 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
<h1>Table of Contents<span class="tocSkip"></span></h1>
<div class="toc"><ul class="toc-item"><li><span><a href="#Data" data-toc-modified-id="Data-1"><span class="toc-item-num">1 ... | Python Code:
import sys
import yaml
import tensorflow as tf
import numpy as np
import pandas as pd
import functools
from pathlib import Path
from datetime import datetime
from tqdm import tqdm_notebook as tqdm
# Plotting
import matplotlib
import matplotlib.pyplot as plt
from matplotlib import animation
plt.rcParams['an... |
7,009 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Homework 6
CHE 116
Step1: 4. Prediction Intervals and Loops (19 Points + 12 EC)
[1 point] "The 95% prediction interval for a geometric probability distribution" can be described with what m... | Python Code:
import matplotlib.pyplot as plt
%matplotlib inline
import numpy as np
#3.1
p = [0.2, 0.5, 0.8]
n = np.arange(1, 8)
for i, pi in enumerate(p):
plt.plot(n, pi * (1 - pi)**(n - 1), 'o-', label='$p={}$'.format(pi), color='C{}'.format(i))
plt.axvline(x = 1/ pi, color='C{}'.format(i))
plt.title('Pro... |
7,010 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Title
Step1: Create some simulated data.
Step2: Create a scatterplot using the a colormap.
Full list of colormaps | Python Code:
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
Explanation: Title: Set The Color Of A Matplotlib Plot
Slug: set_the_color_of_a_matplotlib
Summary: Set The Color Of A Matplotlib Plot
Date: 2016-05-01 12:00
Category: Python
Tags: Data Visualization
Authors: Chris Albon
Import numpy a... |
7,011 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Tutorial how to use xgboost
Step1: Let's do the same for classification problem
Tips
Step2: Visualisation | Python Code:
import xgboost as xgb
from sklearn.datasets import load_boston
from sklearn.cross_validation import train_test_split
from sklearn.metrics import r2_score, auc
boston = load_boston()
#print(boston.DESCR)
print(boston.data.shape)
X_train, X_test, y_train, y_test = train_test_split(boston.data, boston.target)... |
7,012 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Flickr30k Captions to Corpus
P. Young, A. Lai, M. Hodosh, and J. Hockenmaier. From image description to visual denotations
Step1: Plan
Have a look inside the captions flickr30k.tar.gz
Step... | Python Code:
import os
import numpy as np
import datetime
t_start=datetime.datetime.now()
import pickle
data_path = './data/Flickr30k'
output_dir = './data/cache'
output_filepath = os.path.join(output_dir,
'CAPTIONS_%s_%s.pkl' % (
data_path.replace('./'... |
7,013 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
intervals =[[-2.0,-1.1],[-1.0,-0.6],[-0.5,-0.1],[0.0,0.4],[0.5,0.9],[1.0,1.4],
[1.5,1.9],[2.0,2.4],[2.5,2.9],[3.0,3.4],[3.5,3.9],[4.0,5.0]]
Step1: bins =np.array([-2.0,-1.0,-0.5,0.0,... | Python Code:
def fit_normal_to_hist(h):
if not all(h==0):
bins =np.array([-2.0,-1.0,-0.5,0.0,0.5,1.0,1.5,2.0,2.5,3.0,3.5,4.0,5.0])
orig_hist = np.array(h).astype(float)
norm_hist = orig_hist/float(sum(orig_hist))
mid_points = (bins[1:] + bins[:-1])/2
popt,pcov = opt.curve_f... |
7,014 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Day 2 pre-class assignment
Goals for today's pre-class assignment
Make sure that you can get a Jupyter notebook up and running!
Learn about algorithms, computer programs, and their relations... | Python Code:
# The command below this comment imports the functionality that we need to display
# YouTube videos in a Jupyter Notebook. You need to run this cell before you
# run ANY of the YouTube videos.
from IPython.display import YouTubeVideo
Explanation: Day 2 pre-class assignment
Goals for today's pre-class ass... |
7,015 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Using BagIt to tag oceanographic data
BagIt is a packaging format that supports storage of arbitrary digital content. The "bag" consists of arbitrary content and "tags," the metadata files. ... | Python Code:
import os
import pandas as pd
fname = os.path.join("data", "dsg", "timeseriesProfile.csv")
df = pd.read_csv(fname, parse_dates=["time"])
df.head()
Explanation: Using BagIt to tag oceanographic data
BagIt is a packaging format that supports storage of arbitrary digital content. The "bag" consists of arbitra... |
7,016 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Algorithms Exercise 2
Imports
Step2: Peak finding
Write a function find_peaks that finds and returns the indices of the local maxima in a sequence. Your function should
Step3: Here is a st... | Python Code:
%matplotlib inline
from matplotlib import pyplot as plt
import seaborn as sns
import numpy as np
Explanation: Algorithms Exercise 2
Imports
End of explanation
def find_peaks(a):
Find the indices of the local maxima in a sequence.
# YOUR CODE HERE
#I always start with an empty list k.
k=[]
... |
7,017 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
<center>
<img src="http
Step1: <div id='sylvester' />
Sylvester Equation
The Sylvester Equation has the following form matricial form
Step2: Why is the vecoperator useful?
This operato... | Python Code:
import numpy as np
import scipy as sp
from scipy import linalg as la
import scipy.sparse.linalg as spla
import matplotlib.pyplot as plt
%matplotlib inline
import matplotlib as mpl
mpl.rcParams['font.size'] = 14
mpl.rcParams['axes.labelsize'] = 20
mpl.rcParams['xtick.labelsize'] = 14
mpl.rcParams['ytick.lab... |
7,018 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Whitening evoked data with a noise covariance
Evoked data are loaded and then whitened using a given noise covariance
matrix. It's an excellent quality check to see if baseline signals match... | Python Code:
# Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr>
# Denis A. Engemann <denis.engemann@gmail.com>
#
# License: BSD (3-clause)
import mne
from mne import io
from mne.datasets import sample
from mne.cov import compute_covariance
print(__doc__)
Explanation: Whitening evoked data with a noise... |
7,019 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Tutorial
Overview
Ray is a Python-based distributed execution $\bf \text{engine}$. The same code can be run on a single machine to achieve efficient multiprocessing, and it can be used on a ... | Python Code:
import ray
ray.init("172.56.22.22:11592")
Explanation: Tutorial
Overview
Ray is a Python-based distributed execution $\bf \text{engine}$. The same code can be run on a single machine to achieve efficient multiprocessing, and it can be used on a cluster for large computations.
When using Ray, several proces... |
7,020 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
https
Step1: Certain functions in the itertools module may be useful for computing permutations | Python Code:
assert 65 ^ 42 == 107
assert 107 ^ 42 == 65
assert ord('a') == 97
assert chr(97) == 'a'
Explanation: https://projecteuler.net/problem=59
Each character on a computer is assigned a unique code and the preferred standard is ASCII (American Standard Code for Information Interchange). For example, uppercase A ... |
7,021 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Date string for filenames
This will be inserted into all filenames (reading and writing)
Step1: Import & combine generation and CO₂ intensity data
CO₂ intensity
Step2: Generation
Step3: S... | Python Code:
file_date = '2018-03-06'
us_state_abbrev = {
'United States': 'US',
'Alabama': 'AL',
'Alaska': 'AK',
'Arizona': 'AZ',
'Arkansas': 'AR',
'California': 'CA',
'Colorado': 'CO',
'Connecticut': 'CT',
'Delaware': 'DE',
'Florida': 'FL',
'Georgia': 'GA',
'Hawaii': 'H... |
7,022 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
The flexibility that can be seen below can be exploited on these contexts
Step1: It's __repr__ is descent
Step2: Json serializable
Step3: My beloved yaml-serializable
Step4: And of cours... | Python Code:
from fito import as_operation, SpecField, PrimitiveField, Operation
from time import sleep
class DatabaseConnection(Operation):
host = PrimitiveField(pos=0)
def __repr__(self): return "connection(db://{})".format(self.host)
@as_operation(database=SpecField, experiment_config=SpecField)
def run... |
7,023 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Model selection and serving with Ray Tune and Ray Serve
{image} /images/serve.svg
Step4: Data interface
Let's start with a simulated data interface. This class acts as the
interface between... | Python Code:
import argparse
import json
import os
import shutil
import sys
from functools import partial
from math import ceil
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import ray
from ray import tune, serve
from ray.serve.exceptions import RayServeException
from ra... |
7,024 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
02 - Introduction to Machine Learning
by Alejandro Correa Bahnsen
version 0.1, Feb 2016
Part of the class Practical Machine Learning
This notebook is licensed under a Creative Commons Attrib... | Python Code:
# Import libraries
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
sns.set();
cmap = mpl.colors.ListedColormap(sns.color_palette("hls", 3))
# Create a random set of examples
from sklearn.datasets.samples_generator import make_blobs
X, Y = make_blobs(n_samples=50,... |
7,025 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Let's use CoNLL 2002 data to build a NER system
CoNLL2002 corpus is available in NLTK. We use Spanish data.
Step1: Data format
Step2: Features
Next, define some features. In this example w... | Python Code:
nltk.corpus.conll2002.fileids()
%%time
train_sents = list(nltk.corpus.conll2002.iob_sents('esp.train'))
test_sents = list(nltk.corpus.conll2002.iob_sents('esp.testb'))
Explanation: Let's use CoNLL 2002 data to build a NER system
CoNLL2002 corpus is available in NLTK. We use Spanish data.
End of explanation... |
7,026 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Lecture 10
Step1: An example we've already encountered is when we're trying to handle an exception.
Step2: There are different categories of scope. It's always helpful to know which of the... | Python Code:
def func(x):
print(x)
x = 10
func(20)
print(x)
Explanation: Lecture 10: Variable Scope
CSCI 1360: Foundations for Informatics and Analytics
Overview and Objectives
We've spoken a lot about data structures and orders of execution (loops, functions, and so on). But now that we're intimately familiar... |
7,027 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Section 6.4.3
Theis and Hantush implementations and type curves
Timing and accuracy of the implementations
Here we do some testing of Theis and Hantush well function computations using a var... | Python Code:
import numpy as np
from scipy.integrate import quad
from scipy.special import exp1
import matplotlib.pyplot as plt
from timeit import timeit
import pdb
def newfig(title=None, xlabel=None, ylabel=None,
xscale=None, yscale=None, xlim=None, ylim=None, figsize=(12, 8), size=15):
... |
7,028 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Neural Machine Translation
Welcome to your first programming assignment for this week!
You will build a Neural Machine Translation (NMT) model to translate human readable dates ("25th of Ju... | Python Code:
from keras.layers import Bidirectional, Concatenate, Permute, Dot, Input, LSTM, Multiply
from keras.layers import RepeatVector, Dense, Activation, Lambda
from keras.optimizers import Adam
from keras.utils import to_categorical
from keras.models import load_model, Model
import keras.backend as K
import nump... |
7,029 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Deep Learning Tutorial
(C) 2019 by Damir Cavar
This notebook was inspired by numerous totorials and other notebooks online, and books like Weidman (2019), ...
General Conventions
In the foll... | Python Code:
from typing import Callable
Explanation: Deep Learning Tutorial
(C) 2019 by Damir Cavar
This notebook was inspired by numerous totorials and other notebooks online, and books like Weidman (2019), ...
General Conventions
In the following Python code I will make use of type hints for Python to make explicit ... |
7,030 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Moving frame calculations
General idea
Fundamental thing to start with
$$
f(z) = \bar{f}(\bar{z})
$$
Then you need a general group transformation.
Which you should simplify as far as poss... | Python Code:
from sympy import Function, Symbol, symbols, init_printing, expand, I, re, im
from IPython.display import Math, display
init_printing()
from transvectants import *
def disp(expr):
display(Math(my_latex(expr)))
# p and q are \bar{x} \bar{y}
x, y = symbols('x y')
p, q = symbols('p q')
a, b, c, d = symbol... |
7,031 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Chapter 4 in-class problems - Solutions
Using what you learned in Lab, answer questions 4.7, 4.8, 4.10, 4.11, 4.12, and 4.13
Step1: Remember, these states are represented in the HV basis
St... | Python Code:
from numpy import sin,cos,sqrt,pi
from qutip import *
Explanation: Chapter 4 in-class problems - Solutions
Using what you learned in Lab, answer questions 4.7, 4.8, 4.10, 4.11, 4.12, and 4.13
End of explanation
H = Qobj([[1],[0]])
V = Qobj([[0],[1]])
P45 = Qobj([[1/sqrt(2)],[1/sqrt(2)]])
M45 = Qobj([[1/sqr... |
7,032 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Copyright (c) 2017 Geosoft Inc.
https
Step1: Display a grid on a map
One of the most common tasks is to display a data grid in colour.
Step2: Add Contours and Shading
Now we will improve t... | Python Code:
import geosoft.gxpy.gx as gx
import geosoft.gxpy.view as gxview
import geosoft.gxpy.group as gxgroup
import geosoft.gxpy.agg as gxagg
import geosoft.gxpy.grid as gxgrd
import geosoft.gxpy.viewer as gxviewer
import geosoft.gxpy.utility as gxu
import geosoft.gxpy.map as gxmap
from IPython.display import Imag... |
7,033 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
<small><i>This notebook was prepared by Donne Martin. Source and license info is on GitHub.</i></small>
Challenge Notebook
Problem
Step1: Unit Test
The following unit test is expected to fa... | Python Code:
def fib_recursive(n):
# TODO: Implement me
pass
num_items = 10
cache = [None] * (num_items + 1)
def fib_dynamic(n):
# TODO: Implement me
pass
def fib_iterative(n):
# TODO: Implement me
pass
Explanation: <small><i>This notebook was prepared by Donne Martin. Source and license info is... |
7,034 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Building an App Engine app to serve ML predictions
Learning Objectives
Deploy a web application that consumes your model service on Cloud AI Platform.
Introduction
Verify that you have previ... | Python Code:
!sudo chown -R jupyter:jupyter /home/jupyter/training-data-analyst
%%bash
# Check your project name
export PROJECT=$(gcloud config list project --format "value(core.project)")
echo "Your current GCP Project Name is: "$PROJECT
import os
os.environ["BUCKET"] = "your-bucket-id-here" # Recommended: use your pr... |
7,035 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Clase 6
Step1: 2. Generador congruencial lineal
Step2: Ejemplo
Step3: Generador mínimo estándar
Step4: Generado Randu (Usado por IBM)
Step5: 3. Método de Box-Muller | Python Code:
import numpy as np
import seaborn as sns
import scipy.stats as stats
%matplotlib inline
Explanation: Clase 6: Generación de números aleatorios y simulación Montecarlo
Juan Diego Sánchez Torres,
Profesor, MAF ITESO
Departamento de Matemáticas y Física
dsanchez@iteso.mx
Tel. 3669-34-34 Ext. 3069
Oficina: C... |
7,036 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Classification configurations
TODO
add relevant ranges
set proper types for default configuration
find solution for string/float type in numpy
To change configurations, redefine values for r... | Python Code:
def svc_linear_config():
return {
'C': (1.0,),
'kernel': ('linear',),
'shrinking': (True, False),
'probability': (True, False),
'tol': (0.001,),
# 'class_weight': ('balanced',),
'max_iter': (-1,),
'decision_function_shape': ('ovo', 'ovr'),... |
7,037 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Modeling and Simulation in Python
Chapter 15
Copyright 2017 Allen Downey
License
Step1: The coffee cooling problem
I'll use a State object to store the initial temperature.
Step2: And a Sy... | Python Code:
# Configure Jupyter so figures appear in the notebook
%matplotlib inline
# Configure Jupyter to display the assigned value after an assignment
%config InteractiveShell.ast_node_interactivity='last_expr_or_assign'
# import functions from the modsim.py module
from modsim import *
Explanation: Modeling and Si... |
7,038 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Classification
Use up to five categories, thresholding with these values
Step1: That is not very balanced. Better take zero and minus category times two.
Step2: Even the splitted data sets... | Python Code:
def get_categories(y):
y = y.dropna()
plus = (0.1 < y)
zero = (-0.1 <= y) & (y <= 0.1)
minus = (y < -0.1)
return plus, zero, minus
def get_count(plus, zero, minus):
return pd.concat(map(operator.methodcaller("sum"), [plus, zero, minus]), axis=1, keys=["plus", "zero", "minus"])
plus,... |
7,039 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Serializing the model
Jump_to lesson 12 video
Step1: It's also possible to save the whole model, including the architecture, but it gets quite fiddly and we don't recommend it. Instead, jus... | Python Code:
path = datasets.untar_data(datasets.URLs.IMAGEWOOF_160)
size = 128
bs = 64
tfms = [make_rgb, RandomResizedCrop(size, scale=(0.35,1)), np_to_float, PilRandomFlip()]
val_tfms = [make_rgb, CenterCrop(size), np_to_float]
il = ImageList.from_files(path, tfms=tfms)
sd = SplitData.split_by_func(il, partial(grandp... |
7,040 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Author
Step1: First let's check if there are new or deleted files (only matching by file names).
Step2: Cool, no new nor deleted files.
Now let's set up a dataset that, for each table, lin... | Python Code:
import collections
import glob
import os
from os import path
import matplotlib_venn
import pandas as pd
rome_path = path.join(os.getenv('DATA_FOLDER'), 'rome/csv')
OLD_VERSION = '342'
NEW_VERSION = '343'
old_version_files = frozenset(glob.glob(rome_path + '/*{}*'.format(OLD_VERSION)))
new_version_files = f... |
7,041 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
TF-Keras Image Classification Distributed Multi-Worker Training on GPU using Vertex Training with Custom Container
<table align="left">
<td>
<a href="https
Step1: Vertex Training usin... | Python Code:
PROJECT_ID = "YOUR PROJECT ID"
BUCKET_NAME = "gs://YOUR BUCKET NAME"
REGION = "YOUR REGION"
SERVICE_ACCOUNT = "YOUR SERVICE ACCOUNT"
content_name = "tf-keras-img-cls-dist-multi-worker-gpu-cust-cont"
Explanation: TF-Keras Image Classification Distributed Multi-Worker Training on GPU using Vertex Training wi... |
7,042 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
ES-DOC CMIP6 Model Properties - Landice
MIP Era
Step1: Document Authors
Set document authors
Step2: Document Contributors
Specify document contributors
Step3: Document Publication
Specify... | Python Code:
# DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'ncc', 'noresm2-lmec', 'landice')
Explanation: ES-DOC CMIP6 Model Properties - Landice
MIP Era: CMIP6
Institute: NCC
Source ID: NORESM2-LMEC
Topic: Landice
Sub-Topics: Glaciers, Ice.
... |
7,043 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Visualization 1
Step1: Scatter plots
Learn how to use Matplotlib's plt.scatter function to make a 2d scatter plot.
Generate random data using np.random.randn.
Style the markers (color, size... | Python Code:
%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
Explanation: Visualization 1: Matplotlib Basics Exercises
End of explanation
plt.figure(figsize=(10,8))
plt.scatter(np.random.randn(100),np.random.randn(100),s=50,c='b',marker='d',alpha=.7)
plt.xlabel('x-coordinate')
plt.ylabel('y-coordi... |
7,044 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
<a href="https
Step1: Predict Shakespeare with Cloud TPUs and Keras
Overview
This example uses tf.keras to build a language model and train it on a Cloud TPU. This language model predicts t... | Python Code:
# Copyright 2018 The TensorFlow Hub Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless re... |
7,045 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
pyISC Example
Step1: Create Data
Create a data set with 3 columns from different probablity distributions
Step2: Used Anomaly Detector
Create an anomaly detector using as first argument th... | Python Code:
import pyisc;
import numpy as np
from scipy.stats import poisson, norm
%matplotlib inline
from pylab import plot
Explanation: pyISC Example: MultivariableAnomaly Detection
In this example, we extend the simple example with one Poisson distributed variable to the multivariate case with three variables, two ... |
7,046 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Step1: Model10
Step2: Feature functions(private)
Step3: Feature function(public)
Step4: Utility functions
Step5: GMM
Classifying questions
features
Step7: B. Modeling
Select model
Step8... | Python Code:
import gzip
import pickle
from os import path
from collections import defaultdict
from numpy import sign
Load buzz data as a dictionary.
You can give parameter for data so that you will get what you need only.
def load_buzz(root='../data', data=['train', 'test', 'questions'], format='pklz'):
buzz_data ... |
7,047 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
ES-DOC CMIP6 Model Properties - Aerosol
MIP Era
Step1: Document Authors
Set document authors
Step2: Document Contributors
Specify document contributors
Step3: Document Publication
Specify... | Python Code:
# DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'cas', 'sandbox-1', 'aerosol')
Explanation: ES-DOC CMIP6 Model Properties - Aerosol
MIP Era: CMIP6
Institute: CAS
Source ID: SANDBOX-1
Topic: Aerosol
Sub-Topics: Transport, Emissions, ... |
7,048 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Mean, Median, Mode, and introducing NumPy
Mean vs. Median
Let's create some fake income data, centered around 27,000 with a normal distribution and standard deviation of 15,000, with 10,000 ... | Python Code:
import numpy as np
incomes = np.random.normal(27000, 15000, 10000)
np.mean(incomes)
Explanation: Mean, Median, Mode, and introducing NumPy
Mean vs. Median
Let's create some fake income data, centered around 27,000 with a normal distribution and standard deviation of 15,000, with 10,000 data points. (We'll ... |
7,049 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
FloPy Creating Layered Quadtree Grids with GRIDGEN
FloPy has a module that can be used to drive the GRIDGEN program. This notebook shows how it works.
The Flopy GRIDGEN module requires that... | Python Code:
%matplotlib inline
import os
import sys
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
import flopy
from flopy.utils.gridgen import Gridgen
print(sys.version)
print('numpy version: {}'.format(np.__version__))
print('matplotlib version: {}'.format(mpl.__version__))
print('flopy... |
7,050 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Based on similar work with Twin Cities Pioneer Press Schools that Work
Step1: Setting things up
Let's load the data and give it a quick look.
Step2: Checking out correlations
Let's start l... | Python Code:
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from sklearn.linear_model import LinearRegression
%matplotlib inline
Explanation: Based on similar work with Twin Cities Pioneer Press Schools that Work
End of explanation
df = pd.read_csv('data/apib12tx.csv')
df.describe()
Explanation... |
7,051 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Moduly moduly aneb O importování
aliasy
lze importovat jen jednu třídu/funkci/proměnnou, ale moduly mohou mit i více úrovní
Step1: lze naimportovat jednotlive funkce
Step2: ale v jiném mod... | Python Code:
from os import path
path.exists("data.csv")
Explanation: Moduly moduly aneb O importování
aliasy
lze importovat jen jednu třídu/funkci/proměnnou, ale moduly mohou mit i více úrovní
End of explanation
from os.path import exists
Explanation: lze naimportovat jednotlive funkce
End of explanation
from sys impo... |
7,052 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
If you want to add modules from the /src part of the project.
Step1: If you are doing live changes in the src files you plan to use, try the autoreload extension | Python Code:
import sys
sys.path.append(os.path.join(PROJ_ROOT, "src"))
Explanation: If you want to add modules from the /src part of the project.
End of explanation
%load_ext autoreload
%autoreload 1
# now instead of import use %aimport
Explanation: If you are doing live changes in the src files you plan to use, try t... |
7,053 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Step1: Image Classification
In this project, you'll classify images from the CIFAR-10 dataset. The dataset consists of airplanes, dogs, cats, and other objects. You'll preprocess the images... | Python Code:
DON'T MODIFY ANYTHING IN THIS CELL THAT IS BELOW THIS LINE
from urllib.request import urlretrieve
from os.path import isfile, isdir
from tqdm import tqdm
import problem_unittests as tests
import tarfile
cifar10_dataset_folder_path = 'cifar-10-batches-py'
# Use Floyd's cifar-10 dataset if present
floyd_cifa... |
7,054 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Calcule numérique avec la méthode Monte-Carlo (première partie)
TODO
- traduire en français certaines phrases restées en anglais
Approximation numérique d'une surface avec la méthode Monte-C... | Python Code:
import numpy as np
import matplotlib.pyplot as plt
t = np.linspace(0., 2. * np.pi, 100)
x = np.cos(t) + np.cos(2. * t)
y = np.sin(t)
N = 100
rand = np.array([np.random.uniform(low=-3, high=3, size=N), np.random.uniform(low=-3, high=3, size=N)]).T
fig, ax = plt.subplots(1, 1, figsize=(7, 7))
ax.plot(rand[:,... |
7,055 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Load data
Step1: Get the number of coordinates reported for each network
Step2: Generate random coordinates
The assigned coodinates are generated for each network witha proability equivale... | Python Code:
#seed_data = pd.read_csv('20160128_AD_Decrease_Meta_Christian.csv')
template_036= nib.load('/home/cdansereau/data/template_cambridge_basc_multiscale_nii_sym/template_cambridge_basc_multiscale_sym_scale036.nii.gz')
template_020= nib.load('/home/cdansereau/data/template_cambridge_basc_multiscale_nii_sym/temp... |
7,056 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Visualize Raw data
Step1: The visualization module (
Step2: The channels are color coded by channel type. Generally MEG channels are
colored in different shades of blue, whereas EEG channe... | Python Code:
import os.path as op
import numpy as np
import mne
data_path = op.join(mne.datasets.sample.data_path(), 'MEG', 'sample')
raw = mne.io.read_raw_fif(op.join(data_path, 'sample_audvis_raw.fif'),
preload=True)
raw.set_eeg_reference('average', projection=True) # set EEG average refere... |
7,057 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
lasio uses the logging module to log warnings and other information when manipulating LAS files.
Step1: Sometimes you may want more or less information shown to you when you are reading LAS... | Python Code:
import logging
import lasio
Explanation: lasio uses the logging module to log warnings and other information when manipulating LAS files.
End of explanation
l = lasio.read("../tests/examples/sample.las")
Explanation: Sometimes you may want more or less information shown to you when you are reading LAS file... |
7,058 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Step1: Automatic Differentiation
This example demonstrates automatic differentiation using both an operator overloading method and a source code transformation method. The function we will ... | Python Code:
from math import pi
import numpy as np
from math import sin, cos, acos, exp, sqrt
def inductionFactors(r, chord, Rhub, Rtip, phi, cl, cd, B,
Vx, Vy, useCd, hubLoss, tipLoss, wakerotation):
Computes induction factors and residual error at a given location
on the blade. Full details on input... |
7,059 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Implementing a Local Search Engine
This notebook shows one important application of <em style="color
Step1: The function get_text takes a path specifiying a .pdf file. It converts the .pdf... | Python Code:
import subprocess
Explanation: Implementing a Local Search Engine
This notebook shows one important application of <em style="color:blue;">dictionaries</em> and <em style="color:blue;">sets</em>:
It implements a local search engine that can be used to index .pdf documents on the local file system. The ind... |
7,060 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Capture Faces from Scraped Pictures
We used haarcascade for frontal face from OpenCV to capture the frontal faces from the pictures scraped from My Ladyboy Date and Date in Asia, and cropped... | Python Code:
import cv2
from PIL import Image
import math
import copy
#the usual data science stuff
import os,sys
import glob
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
%matplotlib inline
ladyboy_big_input = '../data/ladyboy_big/'
ladyboy_big_output = '../data/processed/ladyboy_big/'
ladyboy... |
7,061 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
<img width=700px; src="../img/logoUPSayPlusCDS_990.png">
<p style="margin-top
Step1: The SciPy library is one of the core packages that make up the SciPy stack. It provides many user-friend... | Python Code:
%matplotlib inline
import numpy as np
import matplotlib.pyplot as plt
Explanation: <img width=700px; src="../img/logoUPSayPlusCDS_990.png">
<p style="margin-top: 3em; margin-bottom: 2em;"><b><big><big><big><big>Introduction to Scipy and Statsmodels libraries</big></big></big></big></b></p>
End of explanati... |
7,062 | Given the following text description, write Python code to implement the functionality described.
Description:
Check if a Rook can reach the given destination in a single move
Function to check if it is possible to reach destination in a single move by a rook ; Given arrays
| Python Code:
def check(current_row , current_col , destination_row , destination_col ) :
if(current_row == destination_row ) :
return("POSSIBLE ")
elif(current_col == destination_col ) :
return("POSSIBLE ")
else :
return("NOT ▁ POSSIBLE ")
current_row = 8
current_col = 8
destination_row = ... |
7,063 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
SAP CAR
The following subsections show a graphical representation of the file format portions and how to generate them.
First we need to perform some setup to import the packet classes
Step1... | Python Code:
from pysap.SAPCAR import *
from IPython.display import display
Explanation: SAP CAR
The following subsections show a graphical representation of the file format portions and how to generate them.
First we need to perform some setup to import the packet classes:
End of explanation
with open("some_file", "w"... |
7,064 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
<a href="https
Step1: Harmonic Minimization
Here we demonstrate some simple example code showing how we might find the inherent structure for some initially random configuration of particle... | Python Code:
#@title Imports & Utils
!pip install jax-md
import numpy as onp
import jax.numpy as np
from jax.config import config
config.update('jax_enable_x64', True)
from jax import random
from jax import jit
from jax_md import space, smap, energy, minimize, quantity, simulate
from jax_md.colab_tools import renderer
... |
7,065 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Step1: Experiments in making a finder chart generator for astroplan
Use astroquery's SkyView to get images of the field near a astroplan.FixedTarget.
Step2: Basic, default plot
Step3: Plot... | Python Code:
import matplotlib.pyplot as plt
import numpy as np
from astroplan import FixedTarget
import astropy.units as u
from astropy.wcs import WCS
from astropy.coordinates import SkyCoord
from astropy.io import fits
from astroquery.skyview import SkyView
@u.quantity_input(fov_radius=u.deg)
def plot_finder_image(ta... |
7,066 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Steady-state superradiance
We consider a system of $N$ two-level systems (TLSs) with identical frequency $\omega_{0}$, incoherently pumped at a rate $\gamma_\text{P}$ and de-excitating at a ... | Python Code:
import matplotlib.pyplot as plt
from qutip import *
from piqs import *
Explanation: Steady-state superradiance
We consider a system of $N$ two-level systems (TLSs) with identical frequency $\omega_{0}$, incoherently pumped at a rate $\gamma_\text{P}$ and de-excitating at a collective emission rate $\gamma_... |
7,067 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Step1: Language Translation
In this project, you’re going to take a peek into the realm of neural network machine translation. You’ll be training a sequence to sequence model on a dataset o... | Python Code:
DON'T MODIFY ANYTHING IN THIS CELL
import helper
import problem_unittests as tests
source_path = 'data/small_vocab_en'
target_path = 'data/small_vocab_fr'
source_text = helper.load_data(source_path)
target_text = helper.load_data(target_path)
Explanation: Language Translation
In this project, you’re going ... |
7,068 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Kubeflow pipelines
Learning Objectives
Step1: Setup a Kubeflow cluster on GCP
TODO 1
To deploy a Kubeflow cluster
in your GCP project, use the AI Platform pipelines
Step2: Create an experi... | Python Code:
!sudo chown -R jupyter:jupyter /home/jupyter/training-data-analyst
pip freeze | grep kfp || pip install kfp
from os import path
import kfp
import kfp.compiler as compiler
import kfp.components as comp
import kfp.dsl as dsl
import kfp.gcp as gcp
import kfp.notebook
Explanation: Kubeflow pipelines
Learning O... |
7,069 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Analyzing Historical Rainfall in Palo Alto, CA with CHIRPS Data
In this Notebook we demonstrate how you can use Climate Hazards Group InfraRed Precipitation With Station (CHIRPS) data. CHIRP... | Python Code:
%matplotlib notebook
import pandas as pd
import numpy
from po_data_process import get_data_from_point_API, make_histogram, make_plot
import warnings
import matplotlib.cbook
warnings.filterwarnings("ignore",category=matplotlib.cbook.mplDeprecation)
Explanation: Analyzing Historical Rainfall in Palo Alto, CA... |
7,070 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Introduction
I downloaded a CSV of City of Chicago employee salary data,
which includes the names, titles, departments and salaries of Chicago employees. I was
interested to see whether men... | Python Code:
workers = pd.read_csv('Current_Employee_Names__Salaries__and_Position_Titles.csv')
Explanation: Introduction
I downloaded a CSV of City of Chicago employee salary data,
which includes the names, titles, departments and salaries of Chicago employees. I was
interested to see whether men and women earn simil... |
7,071 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Churn prediction
Evasão escolar
Churn prediction é um tipo de trabalho muito comum em data science, sendo uma questão de classificação binária. Trada-se do possível abandono de um cliente ou... | Python Code:
import pandas as pd
import numpy as np
from sklearn import svm, datasets
from sklearn.preprocessing import StandardScaler
from sklearn.model_selection import train_test_split
from sklearn import svm
df = pd.read_csv('evasao.csv')
df.head()
df.describe()
features = df[['periodo','bolsa','repetiu','ematraso'... |
7,072 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Time Series Exercise - Solutions
Follow along with the instructions in bold. Watch the solutions video if you get stuck!
The Data
Source
Step1: Use pandas to read the csv of the monthly-mi... | Python Code:
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
%matplotlib inline
Explanation: Time Series Exercise - Solutions
Follow along with the instructions in bold. Watch the solutions video if you get stuck!
The Data
Source: https://datamarket.com/data/set/22ox/monthly-milk-production-poun... |
7,073 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Mass matrix diagonalization (lumping)
Step3: Elemental mass matrices
Step4: The elemental mass matrices look like
Step6: Lumping
One method for lumping is to sum the matrix per rows, i.e.... | Python Code:
from sympy import *
init_session()
Explanation: Mass matrix diagonalization (lumping)
End of explanation
def mass_tet4():
Mass matrix for a 4 node tetrahedron
r, s, t = symbols("r s t")
N = Matrix([1 - r - s - t, r, s, t])
return (N * N.T).integrate((t, 0, 1 - r - s), (s, 0, 1 - r), (r, 0, ... |
7,074 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
ES-DOC CMIP6 Model Properties - Atmos
MIP Era
Step1: Document Authors
Set document authors
Step2: Document Contributors
Specify document contributors
Step3: Document Publication
Specify d... | Python Code:
# DO NOT EDIT !
from pyesdoc.ipython.model_topic import NotebookOutput
# DO NOT EDIT !
DOC = NotebookOutput('cmip6', 'hammoz-consortium', 'sandbox-2', 'atmos')
Explanation: ES-DOC CMIP6 Model Properties - Atmos
MIP Era: CMIP6
Institute: HAMMOZ-CONSORTIUM
Source ID: SANDBOX-2
Topic: Atmos
Sub-Topics: ... |
7,075 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Predicting publications
In this section, we will try to predict whether an user will be an author. If they are an author, we will try to predict the number of stories they would write based ... | Python Code:
# opens raw data
with open ('../data/clean_data/df_profile', 'rb') as fp:
df = pickle.load(fp)
# creates copy with non-missing observations
df_active = df.loc[df.status != 'inactive', ].copy()
Explanation: Predicting publications
In this section, we will try to predict whether an user will be an author... |
7,076 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Python Basics with Numpy (optional assignment)
Welcome to your first assignment. This exercise gives you a brief introduction to Python. Even if you've used Python before, this will help fam... | Python Code:
### START CODE HERE ### (≈ 1 line of code)
test = 'Hellow World'
### END CODE HERE ###
print ("test: " + test)
Explanation: Python Basics with Numpy (optional assignment)
Welcome to your first assignment. This exercise gives you a brief introduction to Python. Even if you've used Python before, this will h... |
7,077 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
<font color='blue'>Data Science Academy - Deep Learning II</font>
Regressão Linear
Para entender completamente L1/L2, começaremos com a forma como eles são usados com regressão linear, que é... | Python Code:
# Import
import numpy as np
import pandas as pd
import random
import matplotlib.pyplot as plt
%matplotlib inline
from matplotlib.pylab import rcParams
rcParams['figure.figsize'] = 12, 10
# Definindo array de input com valores randômicos
x = np.array([i*np.pi/180 for i in range(60,300,4)])
np.random.seed(10... |
7,078 | Given the following text problem statement, write Python code to implement the functionality described below in problem statement
Problem:
Given a list of variant length features, for example: | Problem:
import pandas as pd
import numpy as np
import sklearn
f = load_data()
from sklearn.preprocessing import MultiLabelBinarizer
new_f = MultiLabelBinarizer().fit_transform(f) |
7,079 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Step3: CSE 6040, Fall 2015 [02]
Step5: Q
Step6: 1
Step7: Method 1. Let's use a data structure called a dictionary, which stores (key, value) pairs.
Step8: Method 2. Let's use a different... | Python Code:
quote = I wish you'd stop talking.
I wish you'd stop prying and trying to find things out.
I wish you were dead. No. That was silly and unkind.
But I wish you'd stop talking.
print (quote)
def countWords1 (s):
Counts the number of words in a given input string.
Lines = s.split ('\n')
count = 0
... |
7,080 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Variational Autoencoder in TensorFlow
Variational Autoencoders (VAE) are a popular model that allows for unsupervised (and semi-supervised) learning. In this notebook, we'll implement a simp... | Python Code:
import numpy as np
import matplotlib.pyplot as plt
import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data
slim = tf.contrib.slim
# Import data
mnist = input_data.read_data_sets("MNIST_data/", one_hot=True)
Explanation: Variational Autoencoder in TensorFlow
Variational Autoencode... |
7,081 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Chain Rule
考慮 $F = f(\mathbf{a},\mathbf{g}(\mathbf{b},\mathbf{h}(\mathbf{c}, \mathbf{i}))$
$\mathbf{a},\mathbf{b},\mathbf{c},$ 代表著權重 , $\mathbf{i}$ 是輸入
站在 \mathbf{g} 的角度,為了要更新權重,我們想算
$\fra... | Python Code:
# 參考範例, 各種函數、微分
%run -i solutions/ff_funcs.py
# 參考範例, 計算 loss
%run -i solutions/ff_compute_loss2.py
Explanation: Chain Rule
考慮 $F = f(\mathbf{a},\mathbf{g}(\mathbf{b},\mathbf{h}(\mathbf{c}, \mathbf{i}))$
$\mathbf{a},\mathbf{b},\mathbf{c},$ 代表著權重 , $\mathbf{i}$ 是輸入
站在 \mathbf{g} 的角度,為了要更新權重,我們想算
$\frac{\p... |
7,082 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
LeNet Lab Solution
Source
Step1: The MNIST data that TensorFlow pre-loads comes as 28x28x1 images.
However, the LeNet architecture only accepts 32x32xC images, where C is the number of colo... | Python Code:
from tensorflow.examples.tutorials.mnist import input_data
mnist = input_data.read_data_sets("MNIST_data/", reshape=False)
X_train, y_train = mnist.train.images, mnist.train.labels
X_validation, y_validation = mnist.validation.images, mnist.validation.labels
X_test, y_test = mnist.tes... |
7,083 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Anna KaRNNa
In this notebook, I'll build a character-wise RNN trained on Anna Karenina, one of my all-time favorite books. It'll be able to generate new text based on the text from the book.... | Python Code:
import time
from collections import namedtuple
import numpy as np
import tensorflow as tf
Explanation: Anna KaRNNa
In this notebook, I'll build a character-wise RNN trained on Anna Karenina, one of my all-time favorite books. It'll be able to generate new text based on the text from the book.
This network ... |
7,084 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Invoking an ML API
This notebook demonstrates how to invoke a deployed ML model (in this case, the Google Cloud Natural Language API)
from a batch or streaming pipeline
We will use Apache Be... | Python Code:
%pip install --upgrade --quiet apache-beam[gcp]
Explanation: Invoking an ML API
This notebook demonstrates how to invoke a deployed ML model (in this case, the Google Cloud Natural Language API)
from a batch or streaming pipeline
We will use Apache Beam.
Install Beam
Restart the kernel after installing Bea... |
7,085 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
SuchLinkedTrees
I didn't want to write this either.
Working with linked trees
If you are interested in studying how two groups of organisms interact (or,
rather, have interacted over evolut... | Python Code:
%load_ext Cython
%pylab inline
from SuchTree import SuchTree
import pandas as pd
import numpy as np
import seaborn
from SuchTree import SuchLinkedTrees, pearson
T1 = SuchTree( 'SuchTree/tests/test.tree' )
T2 = SuchTree( 'http://edhar.genomecenter.ucdavis.edu/~russell/fishpoo/fishpoo2_p200_c2_unique_2_clust... |
7,086 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Lets Test Facebook Prophet to predict Cryptocurrency Prices
Prophet is a procedure for forecasting time series data. It is based on an additive model where non-linear trends are fit with yea... | Python Code:
import pandas as pd
import numpy as np
from fbprophet import Prophet
import time
import seaborn as sns
import matplotlib.pyplot as plt
import datetime
%matplotlib inline
import bs4
bs4.__version__
'4.4.1'
import html5lib
html5lib.__version__
'0.9999999'
# top 15 coins - at the time of writing this!
coins =... |
7,087 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Encoder-Decoder Analysis
Model Architecture
Step1: Perplexity on Each Dataset
Step2: Loss vs. Epoch
Step3: Perplexity vs. Epoch
Step4: Generations
Step5: BLEU Analysis
Step6: N-pairs B... | Python Code:
report_file = '/Users/bking/IdeaProjects/LanguageModelRNN/experiment_results/encdec_noing15_200_512_04drb/encdec_noing15_200_512_04drb.json'
log_file = '/Users/bking/IdeaProjects/LanguageModelRNN/experiment_results/encdec_noing15_200_512_04drb/encdec_noing15_200_512_04drb_logs.json'
import json
import matp... |
7,088 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Copyright 2020 The TensorFlow Authors.
Step1: Actor-Critic 방법으로 CartPole의 문제 풀기
<table class="tfo-notebook-buttons" align="left">
<td><a target="_blank" href="https
Step4: 모델
행위자와 비평가는 각... | Python Code:
#@title Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# dist... |
7,089 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Matplotlib
Matplotlib é uma biblioteca para geração de gráficos 2D em python com uma ótima integração com o Jupyter e uma API simples e similar a do Matlab.
Step1: Para a geração de simples... | Python Code:
# permite que os gráficos sejam renderizados no notebook
%matplotlib inline
import matplotlib.pyplot as plt #API para geração de gráficos
Explanation: Matplotlib
Matplotlib é uma biblioteca para geração de gráficos 2D em python com uma ótima integração com o Jupyter e uma API simples e similar a do Matlab.... |
7,090 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Scott Cole
6 May 2017
This notebook is to formalize the hypothesis that the neural response to a very fast movement in the preferred direction can be more similar to that of a movement in th... | Python Code:
# Import libraries
import numpy as np
%config InlineBackend.figure_format = 'retina'
%matplotlib inline
import matplotlib.pyplot as plt
Explanation: Scott Cole
6 May 2017
This notebook is to formalize the hypothesis that the neural response to a very fast movement in the preferred direction can be more sim... |
7,091 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Title
Step1: Load Data
Step2: Compare Chi-Squared Statistics
Step3: View Results | Python Code:
# Load libraries
from sklearn.datasets import load_iris
from sklearn.feature_selection import SelectKBest
from sklearn.feature_selection import chi2
Explanation: Title: Chi-Squared For Feature Selection
Slug: chi-squared_for_feature_selection
Summary: How to remove irrelevant features using chi-squared for... |
7,092 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Collect the data
Get the name of the 4 fields we have to select
Step1: Get the select field correspondind to the 4 names found before
Step2: Get the value corresponding to the "Informatiqu... | Python Code:
select = soupe.find_all('select')
select_name = [s.attrs['name'] for s in select]
select_name
Explanation: Collect the data
Get the name of the 4 fields we have to select
End of explanation
select_field = [soupe.find('select',{'name': name}) for name in select_name]
Explanation: Get the select field corres... |
7,093 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Radiopadre Tutorial
O. Smirnov <o.smirnov@ru.ac.za>, January 2018
Radiopadre is a framework, built on the Jupyter notebook, ... | Python Code:
from radiopadre import ls, settings
dd = ls() # calls radiopadre.ls() to get a directory listing, assigns this to dd
dd # standard notebook feature: the result of the last expression on the cell is rendered in HTML
dd.show()
print "Calling .show() on an object renders it in HTML anyw... |
7,094 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
6. Reactor
(c) 2019, 2020 Dr. Ramil Nugmanov;
(c) 2019 Dr. Timur Madzhidov; Ravil Mukhametgaleev
Installation instructions of CGRtools package information and tutorial's files see on https
S... | Python Code:
import pkg_resources
if pkg_resources.get_distribution('CGRtools').version.split('.')[:2] != ['4', '0']:
print('WARNING. Tutorial was tested on 4.0 version of CGRtools')
else:
print('Welcome!')
# load data for tutorial
from pickle import load
from traceback import format_exc
with open('reactions.da... |
7,095 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Part 4
Step1: Import libraries
Step2: Configure GCP environment settings
Update the following variables to reflect the values for your GCP environment
Step3: Authenticate your GCP account... | Python Code:
!pip install -q scann
Explanation: Part 4: Create an approximate nearest neighbor index for the item embeddings
This notebook is the fourth of five notebooks that guide you through running the Real-time Item-to-item Recommendation with BigQuery ML Matrix Factorization and ScaNN solution.
Use this notebook ... |
7,096 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Series
Step1: Series é na verdade um array NumPy de 1 dimensão. Ele consiste de um array NumPy com um array de rótulos.
Criando Series
O construtor geral para criar uma Series é da seguinte... | Python Code:
import pandas as pd
Explanation: Series
End of explanation
import numpy as np
ser1 = pd.Series(np.random.rand(7))
ser1
Explanation: Series é na verdade um array NumPy de 1 dimensão. Ele consiste de um array NumPy com um array de rótulos.
Criando Series
O construtor geral para criar uma Series é da seguinte... |
7,097 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
This (article] [http
Step1: Next, enable iPython to display matplotlib graphs. As an alternative you can run ipython notebook.
Step2: We will read in the file like we did in the previous a... | Python Code:
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
pd.__version__
Explanation: This (article] [http://pbpython.com/simple-graphing-pandas.html] will walk through how to start doing some simple graphing in pandas.
I am using a new data file that is the same format as my previous article ... |
7,098 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Loading of Libraries and Classes.
Step1: Create forward bond future PV (Exposure) time profile
Setting up parameters
Step2: Data input for the CouponBond portfolio
The word portfolio is us... | Python Code:
%matplotlib inline
from datetime import date
import time
import pandas as pd
import numpy as np
pd.options.display.max_colwidth = 60
from Curves.Corporates.CorporateDailyVasicek import CorporateRates
from Boostrappers.CDSBootstrapper.CDSVasicekBootstrapper import BootstrapperCDSLadder
from MonteCarloSimula... |
7,099 | Given the following text description, write Python code to implement the functionality described below step by step
Description:
Advanced
Step1: Units
Each FloatParameter or FloatArrayParameter has an associated unit. Let's look at the 'sma' Parameter for the binary orbit.
Step2: From the representation above, we ... | Python Code:
#!pip install -I "phoebe>=2.4,<2.5"
import phoebe
from phoebe import u,c
logger = phoebe.logger(clevel='WARNING')
b = phoebe.default_binary()
Explanation: Advanced: Parameter Units
In this tutorial we will learn about how units are handled in the frontend and how to translate between different units.
Setup... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.