Unnamed: 0
int64
0
15.9k
cleaned_code
stringlengths
67
124k
cleaned_prompt
stringlengths
168
30.3k
14,000
<ASSISTANT_TASK:> Python Code: import os # Google Cloud Notebook if os.path.exists("/opt/deeplearning/metadata/env_version"): USER_FLAG = "--user" else: USER_FLAG = "" ! pip3 install --upgrade google-cloud-aiplatform $USER_FLAG ! pip3 install -U google-cloud-storage $USER_FLAG if os.getenv("IS_TESTING"): !...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Install the latest GA version of google-cloud-storage library as well. Step2: Restart the kernel Step3: Before you begin Step4: Region Step5:...
14,001
<ASSISTANT_TASK:> Python Code: rows = [ {'address': '5412 N CLARK', 'date': '07/01/2012'}, {'address': '5148 N CLARK', 'date': '07/04/2012'}, {'address': '5800 E 58TH', 'date': '07/02/2012'}, {'address': '2122 N CLARK', 'date': '07/03/2012'}, {'address': '5645 N RAVENSWOOD', 'date': '07/02/2012'}, ...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: 现在假设你想在按 date 分组后的数据块上进行迭代。为了这样做,你首先需要按照指定的字段(这里就是 date )排序, 然后调用 itertools.groupby() 函数: Step2: 讨论 Step3: 这样的话你可以很轻松的就能对每个指定日期访问对应的记录:
14,002
<ASSISTANT_TASK:> Python Code: import nltk pos_tweets = [('I love this car', 'positive'), ('This view is amazing', 'positive'), ('I feel great this morning', 'positive'), ('I am so excited about the concert', 'positive'), ('He is my best friend', 'positive')] neg_tweets = [('I do not like this car', 'ne...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Extracting Features Step2: To create a classifier, we need to decide what features are relevant. To do that, we first need a feature extractor....
14,003
<ASSISTANT_TASK:> Python Code: # Load the needed packages from glob import glob import matplotlib.pyplot as plt import numpy as np import awot from awot.graph.common import create_basemap from awot.graph import RadarHorizontalPlot, RadarVerticalPlot, FlightLevel %matplotlib inline import warnings warnings.filterwarning...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: <b>Supply input data and set some plotting parameters.</b> Step2: <b>Set up some characteristics for plotting.</b> Step3: <b>Read in the fligh...
14,004
<ASSISTANT_TASK:> Python Code: import numpy as np import pandas as pd import matplotlib.pyplot as plt from sklearn.linear_model import LogisticRegression from sklearn.preprocessing import MinMaxScaler from sklearn.metrics import accuracy_score from mpl_toolkits.mplot3d import Axes3D %matplotlib inline df = pd.read_csv...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Introdução Step2: Vamos utilizar o sklearn como gabarito para nossa implementação. Entretanto, como a Regressão Logística do sklearn faz uma re...
14,005
<ASSISTANT_TASK:> 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 writin...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: TFX Estimator コンポーネントのチュートリアル Step2: TFX をインストールする Step3: ランタイムを再起動しましたか? Step4: ライブラリのバージョンを確認します。 Step5: パイプライン パスを設定 Step6: サンプルデータのダウンロ...
14,006
<ASSISTANT_TASK:> Python Code: import re def tokenize(s): '''Transform the string s into a list of tokens. The string s is supposed to represent an arithmetic expression. ''' lexSpec = r'''([ \t\n]+) | # blanks and tabs ([1-9][0-9]*|0) | # number ([-+*/()]...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: The function tokenize transforms the string s into a list of tokens. See below for an example. Step2: Testing
14,007
<ASSISTANT_TASK:> Python Code: # DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'bcc', 'sandbox-3', 'atmos') # Set as follows: DOC.set_author("name", "email") # TODO - please enter value(s) # Set as follows: DOC.set_contributor("name", "email...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Document Authors Step2: Document Contributors Step3: Document Publication Step4: Document Table of Contents Step5: 1.2. Model Name Step6: 1...
14,008
<ASSISTANT_TASK:> 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 ...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Image Classification Step2: Explore the Data Step5: Implement Preprocess Functions Step8: One-hot encode Step10: Randomize Data Step12: Che...
14,009
<ASSISTANT_TASK:> Python Code: from IPython.display import display from IPython.display import Image from IPython.display import HTML assert True # leave this to grade the import statements Image(url='https://english.tau.ac.il/sites/default/files/styles/reaserch_main_image_580_x_330/public/sackler%20physics%20cropped....
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Basic rich display Step3: Use the HTML object to display HTML in the notebook that reproduces the table of Quarks on this page. This will requi...
14,010
<ASSISTANT_TASK:> Python Code: %pylab inline %matplotlib inline import os SHOGUN_DATA_DIR=os.getenv('SHOGUN_DATA_DIR', '../../../data') #To import all Shogun classes from shogun import * import shogun as sg #Load the file data_file=LibSVMFile(os.path.join(SHOGUN_DATA_DIR, 'uci/diabetes/diabetes_scale.svm')) f=SparseR...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: In a general problem setting for the supervised learning approach, the goal is to learn a mapping from inputs $x_i\in\mathcal{X} $ to outputs $y...
14,011
<ASSISTANT_TASK:> Python Code: def solve(i , tight , sum_so_far , Sum , number , length ) : if i == length : if sum_so_far == Sum : return 1  else : return 0   ans = dp[i ][tight ][sum_so_far ] if ans != - 1 : return ans  ans = 0 for currdigit in range(0 , 10 ) : currdigitstr = str(currd...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description:
14,012
<ASSISTANT_TASK:> Python Code: ## import Python libraries import ipyrad as ip %%bash ## this will take about XX minutes to run, sorry, the code is not parallelized ## we simulate 360 tips by using the default 12 taxon tree and requesting 40 ## individuals per taxon. Default is theta=0.002. Crown age= 5*2Nu (check this)...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Load the data set with ipyrad Step2: Demultiplex the data files Step3: The data files Step4: Assemble the data set with ipyrad
14,013
<ASSISTANT_TASK:> Python Code: from __future__ import division, print_function import sys import numpy as np import scipy as sp import matplotlib as mpl print('System: {}'.format(sys.version)) print('numpy version: {}'.format(np.__version__)) print('scipy version: {}'.format(sp.__version__)) print('matplotlib version: ...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: We will also need some specific modules and a litle "IPython magic" to show the plots Step2: Back to top Step3: For the LTI system we will use...
14,014
<ASSISTANT_TASK:> Python Code: from ipyparallel import Client cl = Client() cl.ids %%px --local # run whole cell on all engines a well as in the local IPython session import numpy as np import sys sys.path.insert(0, '/home/claudius/Downloads/dadi') import dadi %%px --local # import 1D spectrum of ery on all engines: fs...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Table of Contents Step2: Exponential growth Step3: ERY Step4: The time parameter is hitting the upper boundary that I set. The exponential gr...
14,015
<ASSISTANT_TASK:> Python Code: from __future__ import print_function import tensorflow as tf import numpy as np from datetime import date date.today() author = "kyubyong. https://github.com/Kyubyong/tensorflow-exercises" tf.__version__ np.__version__ sess = tf.InteractiveSession() x = tf.constant([[1, 0, 0, 0], ...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Sparse Tensor Representation & Conversion Step2: Q2. Investigate the dtype, indices, dense_shape and values of the SparseTensor sp in Q1. Step3...
14,016
<ASSISTANT_TASK:> Python Code: %matplotlib inline import matplotlib.pyplot as plt import numpy as np from ipywidgets import interact ALPHA = 0.5 BETA = 0.7 TBAR = 100 LBAR = 100 def F(T,L,alpha=ALPHA): return (T**alpha)*(L**(1-alpha)) def FL(T,L,alpha=ALPHA): Shadow price of labor return (1-alpha)*F(T,L,alp...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step3: Farm Household Models Step4: Inverse farm size productivity relationship Step5: If you are running this notebook in interactive mode you can p...
14,017
<ASSISTANT_TASK:> Python Code: import pandas as pd df = pd.DataFrame.from_dict(results) # Transpose df = df.T # NaN -> 0 df = df.fillna(0) df['pass_rate'] = df['success'] / (df['failed'] + df['success']) # sort by failed df = df.sort_values(by=["pass_rate"]) df import requests cache = {} build_info_cache = {} build_ma...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Finding flakiest individual tests
14,018
<ASSISTANT_TASK:> Python Code: import numpy as np #importing numpy import pandas as pd #importing pandas from bs4 import BeautifulSoup #importing Beautiful Soup import requests import html5lib #importing html5lib, as per Pandas read_html request import re path_to_bday_frequencies = '/Users/alexfreedman/Desktop/Stern/D...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: The following data was gathered from http Step2: Using the help of my data scientist friend I was able to scrape a wikipedia table of prominent...
14,019
<ASSISTANT_TASK:> Python Code: PATH_NEWS_ARTICLES="/home/phoenix/Documents/HandsOn/Final/news_articles.csv" ARTICLES_READ=[4,5,7,8] NUM_RECOMMENDED_ARTICLES=5 ALPHA = 0.5 import pandas as pd import numpy as np from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.metrics.pairwise import cosine_simila...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: 1. Represent articles in terms TF-IDF Matrix Step2: 2. Represent user in terms of articles read Step3: 3. Calculate cosine similarity between ...
14,020
<ASSISTANT_TASK:> Python Code: import numpy as np import pandas as pd from sklearn.feature_extraction.text import CountVectorizer corpus = [ 'We are looking for Java developer', 'Frontend developer with knowledge in SQL and Jscript', 'And this is the third one.', 'Is this the first document?', ] vectori...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description:
14,021
<ASSISTANT_TASK:> Python Code: from __future__ import print_function, division % matplotlib inline import warnings warnings.filterwarnings('ignore') import numpy as np from thinkbayes2 import Pmf, Cdf, Suite, Beta import thinkplot def Odds(p): return p / (1-p) def Probability(o): return o / (o+1) p = 0.2 Odd...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Odds Step2: And this function converts from odds to probabilities. Step3: If 20% of bettors think my horse will win, that corresponds to odds ...
14,022
<ASSISTANT_TASK:> Python Code: # some code in python def f(x): y = x * x return y import IPython print("Hello world!") 2*2 def decorator(f): return f @decorator def f(x): pass 3*3 print(4*4) %%bash echo 'hello' import numpy as np import matplotlib.pyplot as plt %matplotlib inline plt.imshow(np.random...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Random code Step2: some text Step3: An image
14,023
<ASSISTANT_TASK:> Python Code: # imports import networkx as nx %matplotlib inline import matplotlib.pyplot as plt params = {'legend.fontsize':'small', 'figure.figsize': (7,7), 'axes.labelsize': 'small', 'axes.titlesize': 'small', 'xtick.labelsize':'small', 'ytick.labels...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Network Dynamics Step2: THRG Step3: Average Node Degree for the group of K=20 generated graphs. Step4: Looking at the Avg Nodes and Edges in ...
14,024
<ASSISTANT_TASK:> Python Code: import pymatgen as mg #The constructor is simply the value + a string unit. e = mg.Energy(1000, "Ha") #Let's perform a conversion. Note that when printing, the units are printed as well. print "{} = {}".format(e, e.to("eV")) #To check what units are supported print "Supported energy units...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Units support all functionality that is supported by floats. Unit combinations are automatically taken care of. Step2: Note that complex units ...
14,025
<ASSISTANT_TASK:> Python Code: import numpy as np import matplotlib.pyplot as plt import warnings with warnings.catch_warnings(): # suppress annoying TensorFlow FutureWarnings warnings.filterwarnings("ignore",category=FutureWarning) import wobble data = wobble.Data('../data/51peg_e2ds.hdf5') results = wobb...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: viewing more optimization info Step2: toggle on the save_history keyword (which is False by default) to generate a wobble.History object when o...
14,026
<ASSISTANT_TASK:> Python Code: import sys sys.path.append('..') import socnet as sn sn.node_size = 10 sn.node_color = (0, 0, 0) sn.edge_width = 1 g = sn.generate_complete_graph(15) sn.show_graph(g) from random import shuffle def randomize_types(g, num_openers, num_closers, num_chummies): if num_openers + num_clo...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Configurando a biblioteca Step2: Gerando um grafo completo Step3: Esse será o grafo da comunidade. Step4: Atribuindo aleatoriamente existênci...
14,027
<ASSISTANT_TASK:> Python Code: # Environment at time of execution %load_ext watermark %pylab inline %watermark -a "Anthony Abercrombie" -d -t -v -p numpy,pandas,matplotlib -g from __future__ import print_function import os import pandas as pd import matplotlib.pyplot as plt import seaborn as sns import dotenv import os...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: where is spark-ec2? Step2: Numerical DataFlow with Spark and Tensorflow
14,028
<ASSISTANT_TASK:> Python Code: from os.path import basename, exists def download(url): filename = basename(url) if not exists(filename): from urllib.request import urlretrieve local, _ = urlretrieve(url, filename) print("Downloaded " + local) download("https://github.com/AllenDowney/Thin...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Exponential distribution Step2: Here's the distribution of interarrival times from a dataset of birth times. Step3: Here's what the CCDF looks...
14,029
<ASSISTANT_TASK:> Python Code: #!wget http://www.remss.com/data/msu/data/netcdf/uat4_tb_v03r03_avrg_chTLT_197812_201308.nc3.nc #!mv uat4_tb_v03r03_avrg_chTLT_197812_201308.nc3.nc data/ #!wget http://www.remss.com/data/msu/data/netcdf/uat4_tb_v03r03_anom_chTLT_197812_201308.nc3.nc #!mv uat4_tb_v03r03_anom_chTLT_197812_2...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step2: Weight functions Step3: Netcdf data Step4: We need to calculate the element area (on a unit sphere) as follows Step5: Let's create averaging ...
14,030
<ASSISTANT_TASK:> Python Code: # built-in python modules import os import inspect # scientific python add-ons import numpy as np import pandas as pd # plotting stuff # first line makes the plots appear in the notebook %matplotlib inline import matplotlib.pyplot as plt # seaborn makes your plots look better try: im...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Diffuse irradiance models Step2: Perez Step3: HayDavies Step4: Isotropic Step5: King Diffuse model Step6: Klucher Model Step7: Reindl Step...
14,031
<ASSISTANT_TASK:> Python Code: #%matplotlib inline import numpy as num, astropy.io.fits as pyf,pylab as pyl from trippy import psf, pill, psfStarChooser from trippy import scamp,MCMCfit import scipy as sci from os import path import os from astropy.visualization import interval, ZScaleInterval def trimCatalog(cat): ...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: The function trim catalog is a convenience function to simply return only those sources that are well enough isolated for PSF generation. It rej...
14,032
<ASSISTANT_TASK:> Python Code: !pip install -U optax distrax dm-haiku from typing import Any, Iterator, Mapping, Optional, Sequence, Tuple import distrax import haiku as hk import jax import jax.numpy as jnp import numpy as np import optax import tensorflow_datasets as tfds import matplotlib.pyplot as plt Array = jnp....
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Importing all required libraries and packages Step3: Conditioner Step5: Flow Model Step6: Data Loading and preparation Step7: Log Probabilit...
14,033
<ASSISTANT_TASK:> Python Code: from tardis.io.util import HDFWriterMixin class ExampleClass(HDFWriterMixin): hdf_properties = ['property1', 'property2'] hdf_name = 'mock_setup' def __init__(self, property1, property2): self.property1 = property1 self.property2 = property2 import num...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: You can now save properties using to_hdf method. Step2: You can now read hdf file using pd.HDFStore , or pd.read_hdf Step3: Saving nested clas...
14,034
<ASSISTANT_TASK:> Python Code: from __future__ import unicode_literals, division, print_function, absolute_import from builtins import range import numpy as np np.random.seed(28) import matplotlib.pyplot as plt from sklearn.linear_model import Ridge from sklearn.decomposition import PCA, KernelPCA from sklearn.datasets...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Handwritten Digits (8x8 px) Step2: SimEc based on class labels Step3: Lets first try a simple linear SimEc. Step4: Great, we already see some...
14,035
<ASSISTANT_TASK:> Python Code: count = 1 for elem in range(1, 3 + 1): count *= elem print(count) from math import factorial as f f(3) .1*10**20 def n_max(): inpt = eval(input("Please enter some values: ")) maximum = max_val(inpt) print("The largest value is", maximum) def max_val(ints): ...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: 3. Extend your program to n objects. How many different combinations do I have for 5 objects? How about 15? What is the max number of objects I ...
14,036
<ASSISTANT_TASK:> Python Code: # DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'nasa-giss', 'sandbox-1', 'aerosol') # Set as follows: DOC.set_author("name", "email") # TODO - please enter value(s) # Set as follows: DOC.set_contributor("name"...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Document Authors Step2: Document Contributors Step3: Document Publication Step4: Document Table of Contents Step5: 1.2. Model Name Step6: 1...
14,037
<ASSISTANT_TASK:> Python Code: # %sh # wget https://raw.githubusercontent.com/jgoodall/cinevis/master/data/csvs/moviedata.csv # ls -l import pandas as pd import matplotlib.pyplot as plt %matplotlib inline import seaborn as sns hollywood_movies = pd.read_csv('moviedata.csv') print hollywood_movies.head() print hollywood...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: 2 Step2: 3 Step3: 4 Step4: 5 Step5: 6
14,038
<ASSISTANT_TASK:> Python Code: import sys print("Path (sys.path):") for f in sys.path: print(f) import os print("Current directory:") print(os.getcwd()) import agreg.memoisation <END_TASK>
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Importing a file
14,039
<ASSISTANT_TASK:> Python Code: from salib import extend import pandas as pd import os, os.path try: from StringIO import StringIO except ImportError: from io import StringIO import hashlib from IPython.core.magic import register_cell_magic import re class Table(pd.DataFrame): A Table is just like a pa...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step2: class Table Step3: class DataSource Step4: Reading Tables Step5: Writing Tables
14,040
<ASSISTANT_TASK:> Python Code: raw_data = [1,2,3,4,5,6,7,8,9,10] # Define a generator that yields input+6 def add_6(numbers): for x in numbers: output = x+6 yield output # Define a generator that yields input-2 def subtract_2(numbers): for x in numbers: output = x-2 yield output...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Create Data Processing Functions Step2: Create Data Pipeline Step3: Send First Two Pieces Of Raw Data Through Pipeline Step4: Send All Raw Da...
14,041
<ASSISTANT_TASK:> Python Code: import requests import json # requests_toolbelt module is used to handle the multipart responses. # Need to `pip install requests-toolbelt` from a terminal to install. This might need doing each time the Notebook pod starts from requests_toolbelt.multipart import decoder # Define some URL...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Check basic operation Step2: Authentication Step3: List all services Step4: Getting details of a particular service Step5: List all jobs Ste...
14,042
<ASSISTANT_TASK:> Python Code: # Tensorflow import tensorflow as tf print('Tested with TensorFlow 1.2.0') print('Your TensorFlow version:', tf.__version__) # Feeding function for enqueue data from tensorflow.python.estimator.inputs.queues import feeding_functions as ff # Rnn common functions from tensorflow.contrib.le...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Loading Data Step2: We can search our word list for a word like "baseball", and then access its corresponding vector through the embedding matr...
14,043
<ASSISTANT_TASK:> Python Code: # DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'test-institute-3', 'sandbox-1', 'landice') # Set as follows: DOC.set_author("name", "email") # TODO - please enter value(s) # Set as follows: DOC.set_contributor...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Document Authors Step2: Document Contributors Step3: Document Publication Step4: Document Table of Contents Step5: 1.2. Model Name Step6: 1...
14,044
<ASSISTANT_TASK:> Python Code: import requests import json from my_scopus import MY_API_KEY, PROXY_URL, MY_AUTHOR_ID def print_json(resp_json): print(json.dumps(resp_json, sort_keys=True, indent=4, separators=(',', ': '))) def scopus_get_info_api(url, proxy=PROXY_URL,*,verbose=Fal...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step2: First, we define a function to access to the information Step3: Then, a util function to show the information Step4: Example, to obtain my h-i...
14,045
<ASSISTANT_TASK:> Python Code: %load_ext watermark %watermark -a 'Sebastian Raschka' -u -d -v -p numpy,pandas,matplotlib,scipy,scikit-learn # to install watermark just uncomment the following line: #%install_ext https://raw.githubusercontent.com/rasbt/watermark/master/watermark.py from sklearn.datasets import make_blo...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: <br> Step2: <br> Step3: <br> Step4: Comparison to "bad" clustering Step5: <br> Step6: <br> Step7: We can either pass a condensed distance ...
14,046
<ASSISTANT_TASK:> Python Code: from theano.sandbox import cuda cuda.use('gpu1') %matplotlib inline from __future__ import print_function, division #path = "data/state/" path = "data/state/sample/" import utils; reload(utils) from utils import * from IPython.display import FileLink batch_size=64 %cd data/state %cd trai...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Create sample Step2: Create batches Step3: Basic models Step4: As you can see below, this training is going nowhere... Step5: Let's first ch...
14,047
<ASSISTANT_TASK:> 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...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: CelebA Progressive GAN 모델로 인공 얼굴 생성하기 Step2: 잠재 공간 보간 Step3: 잠재 공간에서 가장 가까운 벡터 찾기 Step4: 대상 이미지와 잠재 공간 변수에 의해 생성된 이미지 사이의 손실 함수를 정의한 후, 경사 하강...
14,048
<ASSISTANT_TASK:> Python Code: theta0 = 0.6 a0, b0 = 1, 1 print("step 0: mode = unknown") xx = np.linspace(0, 1, 1000) plt.plot(xx, sp.stats.beta(a0, b0).pdf(xx), label="initial"); np.random.seed(0) x = sp.stats.bernoulli(theta0).rvs(50) N0, N1 = np.bincount(x, minlength=2) a1, b1 = a0 + N1, b0 + N0 plt.plot(xx, sp.sta...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: 카테고리 분포의 모수 추정 Step2: 정규 분포의 기댓값 모수 추정
14,049
<ASSISTANT_TASK:> Python Code: %matplotlib notebook import matplotlib.pyplot as plt import numpy as np import polo import demo data = demo.generate_data() print data.head() facets = {'subplot' : 'nx', 'line' : 'solver_type', 'slider' : 'time'} # Select only rows for WENO5 and TVD runs tvd_weno5 = ...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Let's generate some demonstration data from a set of PyClaw runs Step2: Here data is a Pandas DataFrame; each row corresponds to one output tim...
14,050
<ASSISTANT_TASK:> Python Code: # Here we make the list of the free models # the fixed component is handled seperately modelList = [ draco, galdif ] par_index = 0 # This is the index of the source we care about (i.e., Draco) help(lfu.NLL_func) ftomin = lfu.NLL_func(n_obs,fixed,modelList) init_pars = np.ones((2)) print...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Ok, now we are going to construct a function that will return the negative log-likelihood for a particular set of normailzation of the draco and...
14,051
<ASSISTANT_TASK:> Python Code: print(__doc__) import numpy as np np.random.seed(237) import matplotlib.pyplot as plt noise_level = 0.1 def f(x, noise_level=noise_level): return np.sin(5 * x[0]) * (1 - np.tanh(x[0] ** 2))\ + np.random.randn() * noise_level # Plot f(x) + contours x = np.linspace(-2, 2, 4...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Toy example Step2: Note. In skopt, functions $f$ are assumed to take as input a 1D Step3: Bayesian optimization based on gaussian process regr...
14,052
<ASSISTANT_TASK:> Python Code: from sklearn.datasets import fetch_olivetti_faces dataset = fetch_olivetti_faces() X = dataset.data y = dataset.target import numpy as np np.random.seed(21) idx_rand = np.random.randint(len(X), size=8) import matplotlib.pyplot as plt %matplotlib inline plt.figure(figsize=(14, 8)) for p,...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Although the original images consisted of 92 x 112 pixel images, the version available Step2: We can plot these example images using Matplotlib...
14,053
<ASSISTANT_TASK:> Python Code: print("Happy Birthday, dear Carol!") def happy_birthday_carol(): print("Happy Birthday, dear Carol!") happy_birthday_carol() happy_birthday_carol def happy_birthday_rise(): print("Happy Birthday, dear Rise!") happy_birthday_rise() def happy_birthday(name): print("Happy B...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: We can make this code into a function like so. Let's take a quick look at what we have here. Step2: Examine the function in detail Step3: Don'...
14,054
<ASSISTANT_TASK:> Python Code: import pandas as pd import numpy as np import pickle import matplotlib.pyplot as plt from scipy import stats import tensorflow as tf import seaborn as sns from pylab import rcParams from sklearn.model_selection import train_test_split from keras.models import Model, load_model from keras....
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Loading the data Step2: Exploration Step3: 31 columns, 2 of which are Time and Amount. The rest are output from the PCA transformation. Let's ...
14,055
<ASSISTANT_TASK:> Python Code: # import pandas, but call it pd. Why? Because that's What People Do. import pandas as pd # We're going to call this df, which means "data frame" # It isn't in UTF-8 (I saved it from my mac!) so we need to set the encoding df = pd.read_csv("NBA-Census-10.14.2013.csv", encoding='mac_roman'...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: When you import pandas, you use import pandas as pd. That means instead of typing pandas in your code you'll type pd. Step2: A dataframe is bas...
14,056
<ASSISTANT_TASK:> Python Code: import numpy as np import pandas as pd import matplotlib.pyplot as plt from matplotlib import patches, cm from matplotlib.ticker import LinearLocator, FormatStrFormatter from mpl_toolkits.mplot3d import Axes3D %matplotlib inline from IPython.display import display, Latex, Markdown from ip...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step3: Understanding Gradient Descent Step6: Question 2 Step7: Question 3 Step8: Question 4 Step9: We create some toy data in two dimensions to per...
14,057
<ASSISTANT_TASK:> Python Code: from __future__ import print_function !pip install -q papermill !pip install -q matplotlib !pip install -q networkx import os import tfx_utils %matplotlib notebook def _make_default_sqlite_uri(pipeline_name): return os.path.join(os.environ['HOME'], 'airflow/tfx/metadata', pipeline_nam...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Now print out the data artifacts Step2: Now visualize the dataset features. Step3: Now plot the artifact lineage
14,058
<ASSISTANT_TASK:> Python Code: import numpy as np import zarr zarr.__version__ import numcodecs numcodecs.__version__ z = zarr.empty(10, chunks=5, dtype=object, object_codec=numcodecs.MsgPack()) z z.info z[0] = 'foo' z[1] = b'bar' # msgpack doesn't support bytes objects correctly z[2] = 1 z[3] = [2, 4, 6, 'baz'] z[4...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: API changes in Zarr version 2.2 Step2: To maintain backwards compatibility with previously-created data, the object codec is treated as a filte...
14,059
<ASSISTANT_TASK:> Python Code: import numpy as np import matplotlib.pyplot as plt # A first attempt (we ignore the target for now) image_size = (1280, 1024) # Size of background in pixels nDistractors = 10 # Number of distractors distractor_size = 500 # Generate positions where to put the distractors xr = np.random.r...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Two problem are visible Step2: New problem. Seems like only the x-, and y-, coordinates of the grid elements were defined, but not the location...
14,060
<ASSISTANT_TASK:> Python Code: %matplotlib inline import matplotlib.pyplot as plt import numpy as np np.set_printoptions(precision=2) from sklearn.datasets import load_digits from sklearn.model_selection import train_test_split from sklearn.svm import LinearSVC digits = load_digits() X, y = digits.data, digits.target X...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Vemos que hemos predicho alrededor de un 95% de patrones de forma correcta. Para problemas multi-clase, a veces es muy útil saber qué clases son...
14,061
<ASSISTANT_TASK:> Python Code: def get_glove(name): with open(path+ 'glove.' + name + '.txt', 'r') as f: lines = [line.split() for line in f] words = [d[0] for d in lines] vecs = np.stack(np.array(d[1:], dtype=np.float32) for d in lines) wordidx = {o:i for i,o in enumerate(words)} save_array(res_pat...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Looking at the vectors Step2: Here's the first 25 "words" in glove. Step3: This is how you can look up a word vector. Step4: Just for fun, le...
14,062
<ASSISTANT_TASK:> Python Code: def caps(val): caps returns double the value of the provided value return val*2 a = caps("TEST ") print(a) print(caps.__doc__) a = caps(1234) print(a) def isValid(data): if 10 in data: return True return False a = isValid([10, 200, 33, "asf"]) print(a) ...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Functions Step3: In the above example, we have caps as function, which takes val as argument and returns val * 2. Step4: Functions can return ...
14,063
<ASSISTANT_TASK:> Python Code: from functools import reduce import os import subprocess import tempfile import numpy as np from planet import api from planet.api import downloader, filters import rasterio from skimage import feature, filters from sklearn.ensemble import RandomForestClassifier # load local modules from ...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Download Mosaics Step2: Classify Mosaics into Forest and Non-Forest Step3: Warp Mosaic to Match Label Masks Step4: Create Training Datasets S...
14,064
<ASSISTANT_TASK:> Python Code: random_seed = 2000 data_in_shape = (3, 6) layer_0 = Input(shape=data_in_shape) layer_1 = TimeDistributed(Dense(4))(layer_0) model = Model(inputs=layer_0, outputs=layer_1) np.random.seed(random_seed) data_in = 2 * np.random.random(data_in_shape) - 1 # set weights to random (use seed for re...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: [wrappers.TimeDistributed.1] wrap a Conv2D layer with 6 3x3 filters (input Step2: export for Keras.js tests
14,065
<ASSISTANT_TASK:> Python Code: # ConWhAt stuff from conwhat import VolConnAtlas,StreamConnAtlas,VolTractAtlas,StreamTractAtlas from conwhat.viz.volume import plot_vol_scatter # Neuroimaging stuff import nibabel as nib from nilearn.plotting import (plot_stat_map,plot_surf_roi,plot_roi, plot_...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: We now use the synthetic lesion constructed in the previous example in a ConWhAt lesion analysis. Step2: Take another quick look at this mask S...
14,066
<ASSISTANT_TASK:> Python Code: %%capture --no-stderr KFP_PACKAGE = 'https://storage.googleapis.com/ml-pipeline/release/0.1.14/kfp.tar.gz' !pip3 install $KFP_PACKAGE --upgrade import kfp.components as comp dataproc_create_cluster_op = comp.load_component_from_url( 'https://raw.githubusercontent.com/kubeflow/pipelin...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Load the component using KFP SDK Step2: Sample Step3: Example pipeline that uses the component Step4: Compile the pipeline Step5: Submit the...
14,067
<ASSISTANT_TASK:> Python Code: import numpy as np list = ['a', 'b', 'c', 'd'] list np.array(list) list_matrix = [[1, 2, 3, 4, 5, 6, 7, 8, 9]] list_matrix np.array(list_matrix) np.arange(1, 11) np.arange(5, 60, 5) np.zeros(10) np.zeros((5, 5)) np.ones(10) np.ones((5,5)) np.linspace(10, 20, 5) np.linspace(100, 101, ...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: NumPy Arrays Step2: arange method Step3: zeros method Step4: ones method Step5: linspace Step6: eye Step7: Random Step8: randn Step9: ra...
14,068
<ASSISTANT_TASK:> Python Code: def getNumber(n , k ) : if(n % 2 == 0 ) : pos = n // 2 ;  else : pos =(n // 2 ) + 1 ;  if(k <= pos ) : return(k * 2 - 1 ) ;  else : return(( k - pos ) * 2 ) ;   if __name__== "__main __": n = 8 ; k = 5 ; print(getNumber(n , k ) ) ;  <END_TASK>
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description:
14,069
<ASSISTANT_TASK:> Python Code: import tushare as ts import pandas as pd from IPython.display import HTML stock_selected='600487' #历年前十大股东持股情况 #df1为季度统计摘要,data1为前十大持股明细统计 df1, data1 = ts.top10_holders(code=stock_selected, gdtype='0') #gdtype等于1时表示流通股,默认为0 #df1, data1 = ts.top10_holders(code='002281', year=2015, quarter...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: 2、Top 10 share holder Step2: 获取沪深上市公司基本情况。属性包括: Step3: 业绩报告(主表) Step4: 盈利能力 Step5: 营运能力 Step6: 成长能力 Step7: 偿债能力 Step11: 3、CandleStick
14,070
<ASSISTANT_TASK:> Python Code: !pip install git+https://github.com/google/starthinker CLOUD_PROJECT = 'PASTE PROJECT ID HERE' print("Cloud Project Set To: %s" % CLOUD_PROJECT) CLIENT_CREDENTIALS = 'PASTE CREDENTIALS HERE' print("Client Credentials Set To: %s" % CLIENT_CREDENTIALS) FIELDS = { 'auth_read': 'user', ...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: 2. Get Cloud Project ID Step2: 3. Get Client Credentials Step3: 4. Enter Line Item From BigQuery Parameters Step4: 5. Execute Line Item From ...
14,071
<ASSISTANT_TASK:> 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 * radian = ...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Unrolling Step2: And a few more parameters in the Params object. Step4: make_system computes rho_h, which we'll need to compute moment of iner...
14,072
<ASSISTANT_TASK:> Python Code: # Run some setup code for this notebook. import random import numpy as np from cs231n.data_utils import load_CIFAR10 import matplotlib.pyplot as plt # This is a bit of magic to make matplotlib figures appear inline in the notebook # rather than in a new window. %matplotlib inline plt.rcPa...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: We would now like to classify the test data with the kNN classifier. Recall that we can break down this process into two steps Step2: Inline Qu...
14,073
<ASSISTANT_TASK:> Python Code: st = 'Print only the words that start with s in this sentence' #Code here #Code Here #Code in this cell [] st = 'Print every word in this sentence that has an even number of letters' #Code in this cell #Code in this cell st = 'Create a list of the first letters of every word in this ...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Use range() to print all the even numbers from 0 to 10. Step2: Use List comprehension to create a list of all numbers between 1 and 50 that are...
14,074
<ASSISTANT_TASK:> Python Code: # standard library import numpy as np # Parametrization num_agents = 1000 num_covars = 3 betas_true = np.array([0.22, 0.30, -0.1]).T sd_true = 0.01 # Sampling of observables np.random.seed(123) X = np.random.rand(num_agents, num_covars) X[:,0] = 1 # Sampling disturbances eps = np.rando...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Let us have a look at the relationship. Step2: Estimation using Linear Algebra Tools Step3: Estimation using Optimization Tools Step4: Format...
14,075
<ASSISTANT_TASK:> Python Code: # to make sure things are working, run this import pandas as pd print('Pandas version: ', pd.__version__) import pandas as pd import matplotlib.pyplot as plt import datetime as dt %matplotlib inline url = 'http://pages.stern.nyu.edu/~dbackus/Data/beer_production_1947-2004.xlsx' beer ...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: If you get something like "Pandas version Step2: Remind yourself Step3: Question. Can you see consolidation here? Step4: Answer these questio...
14,076
<ASSISTANT_TASK:> Python Code: import pandas as pd df0 = pd.read_csv("../../data/interim/001_normalised_keyed_reviews.csv", sep="\t", low_memory=False) df0.head() # For monitoring duration of pandas processes from tqdm import tqdm, tqdm_pandas # To avoid RuntimeError: Set changed size during iteration tqdm.monitor_inte...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: <span style="color Step2: Thankfully, nltk provides documentation for each tag, which can be queried using the tag, e.g., nltk.help.upenn_tagse...
14,077
<ASSISTANT_TASK:> Python Code:: import cv2 import numpy as np dog_cascade = cv2.CascadeClassifier('dog_face_haar_cascade.xml') dog_face = dog_cascade.detectMultiScale(image) for (x, y, w, h) in dog_face: start_point, end_point = (x, y), (x+ w, y+h) cv2.rectangle(image, pt1= start_point, pt2 = end_point, color = (0, 2...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description:
14,078
<ASSISTANT_TASK:> Python Code: from PIL import Image, ImageDraw import math, colorsys, numpy from matplotlib import colors from IPython.display import Image as ipythonImage ipythonImage(filename = "images/named_colors.png") color_list=('black', 'darkslategray', 'darkgreen', 'green',...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: This sets up the colors we want in our fractal image. Step2: 2. Generating the Mandelbrot Set Step3: Let's test our function Step4: 3. Genera...
14,079
<ASSISTANT_TASK:> Python Code: import os def dir_structure (path=None, decorated=False): read out the full recursive directory structure of `path` and return it as a tuple path - the path where to start the walk (default: `.`) decorated - if True, the actual directory is returned as well as the index ...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step9: Walking the directory tree Step10: read the directory structure Step11: the properties Step12: directories and files as pandas dataframes Ste...
14,080
<ASSISTANT_TASK:> Python Code: import itertools import numpy as np import pandas as pd import seaborn as sb import holoviews as hv np.random.seed(9221999) %reload_ext holoviews.ipython %output holomap='widgets' fig='svg' %%opts Distribution (hist=False kde_kws=dict(shade=True)) d1 = 25 * np.random.randn(500) + 450 d2...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: We can now select static and animation backends Step2: Visualizing Distributions of Data <a id='Histogram'></a> Step3: Thanks to Seaborn you c...
14,081
<ASSISTANT_TASK:> 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' class DLProgress(tqdm): last_b...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Image Classification Step2: Explore the Data Step5: Implement Preprocess Functions Step8: One-hot encode Step10: Randomize Data Step12: Che...
14,082
<ASSISTANT_TASK:> Python Code: %matplotlib inline import matplotlib.pyplot as plt import numpy as np import scipy.stats import scipy.linalg class GaussianKernel(): Expect input as array of shape `(d,N)` of `N` samples in `d`-dimensional space. def __init__(self, data, bandwidth=None): self.data = np.asa...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Scipy vs our code Step2: Stocastic declusting Step3: Via parameter estimation Step4: Stocastic declustering Step5: Stocastic declustering wi...
14,083
<ASSISTANT_TASK:> Python Code: # https://esa.github.io/pykep/ # https://github.com/esa/pykep # https://pypi.python.org/pypi/pykep/ import PyKEP as pk import numpy as np from tqdm import tqdm, trange import matplotlib.pylab as plt %matplotlib inline import seaborn as sns plt.rcParams['figure.figsize'] = 10, 8 from gtoc5...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Taking a look at our Python environment. Step2: Solving a TSPLIB problem with P-ACO Step3: Load each city's (x, y) coordinates. Step4: Calcul...
14,084
<ASSISTANT_TASK:> Python Code: # Import the toolkit and the full Porter Stemmer library import nltk from nltk.stem.porter import * p_stemmer = PorterStemmer() words = ['run','runner','running','ran','runs','easily','fairly'] for word in words: print(word+' --> '+p_stemmer.stem(word)) from nltk.stem.snowball import...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: <font color=green>Note how the stemmer recognizes "runner" as a noun, not a verb form or participle. Also, the adverbs "easily" and "fairly" are...
14,085
<ASSISTANT_TASK:> Python Code: import vcsn language = '\e+a+b+abc+abcd+abdc' b = vcsn.context('lal_char, b') B = vcsn.context('law_char, b') B.polynomial(language).trie() b.expression(language).standard().determinize().strip() series = '<2>\e + <3>a + <4>b + <5>abc + <6>abcd + <7>abdc' q = vcsn.context('lal_char, z')...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Boolean weights (finite language) Step2: Weighted polynomials of words (finite series)
14,086
<ASSISTANT_TASK:> Python Code: from bokeh.io import vform from bokeh.models import CustomJS, ColumnDataSource, Slider from bokeh.plotting import Figure, output_file, show output_file("callback.html") x = [x*0.005 for x in range(0, 200)] y = x source = ColumnDataSource(data=dict(x=x, y=y)) plot = Figure(plot_width=400, ...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Data apps Step2: The next cell shows the start of how to set up something like the WISE app. Step3: The rest of the notebook is not currently ...
14,087
<ASSISTANT_TASK:> Python Code: # restart your notebook if prompted on Colab try: import verta except ImportError: !pip install verta import os # Ensure credentials are set up, if not, use below # os.environ['VERTA_EMAIL'] = # os.environ['VERTA_DEV_KEY'] = # os.environ['VERTA_HOST'] = from verta import Client...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: 1. Define data transformation Step2: 1. b Wrap data transform in a class deriving from VertaModelBase Step3: 2. Define a registered model for ...
14,088
<ASSISTANT_TASK:> Python Code: #@title Licensed under the Apache License, Version 2.0 (the "License"); { display-mode: "form" } # 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 l...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: 변분 추론으로 일반화된 선형 혼합 효과 모델 맞춤 조정하기 Step2: 요약 Step3: 또한 GPU의 가용성을 빠르게 확인합니다. Step5: 데이터세트 얻기 Step6: GLMM 패밀리 전문화하기 Step7: 지리에 관한 내용을 포함하여 모델을 ...
14,089
<ASSISTANT_TASK:> Python Code: import pymongo from pymongo import MongoClient import time import pandas as pd import numpy as np import seaborn as sns import matplotlib.pyplot as plt import csv Client = MongoClient("mongodb://bridges:readonly@nbi-mongo.admin/bridge") db = Client.bridge collection = db["bridges"] def ...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Connecting to National Data Service Step2: Deterioration curves of Northeast United states Step3: Filtering Null Values, Converting JSON forma...
14,090
<ASSISTANT_TASK:> Python Code: import pandas as pd litigation = pd.read_csv("Housing_Litigations.csv") litigation.head() litigation['Boro'].unique() litigation.groupby(by = ['Boro','CaseJudgement']).count() litigation['CaseType'].unique() litigation.groupby(by = ['CaseType', 'CaseJudgement']).count() hpdcomp = pd.re...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Let's take a look at unique values for some of the columns Step2: The above table tells us that Manhattan has the lowest proportion of cases th...
14,091
<ASSISTANT_TASK:> Python Code: ## conda install ipyrad -c ipyrad ## conda install structure -c ipyrad ## conda install clumpp -c ipyrad ## conda install toytree -c eaton-lab import ipyrad.analysis as ipa ## ipyrad analysis toolkit import ipyparallel as ipp ## parallel processing import toyplot ...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Import Python libraries Step2: Parallel cluster setup Step3: Quick guide (tldr;) Step4: Full guide Step5: Create a Structure Class object St...
14,092
<ASSISTANT_TASK:> Python Code: %matplotlib inline import numpy as np import pandas as pd import seaborn as sns import matplotlib.pyplot as plt plt.rcParams['figure.figsize'] = (10, 6) girls = pd.read_csv('../data/girls.csv') girls.head(10) girls.describe(include='all') girls['Waist'].hist(bins=15); sns.distplot(girls...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Посмотрим на Seaborn сразу в действии на данных по моделям месяца по версии журнала Playboy. Step2: Гистограммы. Метод <a href="https Step3: М...
14,093
<ASSISTANT_TASK:> Python Code: %matplotlib inline import os import pandas as pd import datetime import numpy as np import matplotlib.pyplot as plt from IPython.display import YouTubeVideo #!pip install xlrd DATADIR = os.path.join(os.path.expanduser("~"), "DATA", "TimeSeries", "EPA") os.path.exists(DATADIR) files = os...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: We need to create a variable that will tell our program where the data are located Step2: What files are in the directory? Step3: Read the air...
14,094
<ASSISTANT_TASK:> Python Code: import numpy as np import h5py import matplotlib.pyplot as plt from testCases_v3 import * from dnn_utils_v2 import sigmoid, sigmoid_backward, relu, relu_backward %matplotlib inline plt.rcParams['figure.figsize'] = (5.0, 4.0) # set default size of plots plt.rcParams['image.interpolation'] ...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step2: 2 - Outline of the Assignment Step4: Expected output Step6: Expected output Step8: Expected output Step10: Expected output Step12: <table s...
14,095
<ASSISTANT_TASK:> Python Code: import pyart from matplotlib import pyplot as plt import numpy as np import os import s3fs from datetime import datetime as dt %matplotlib inline print(pyart.__version__) import warnings warnings.simplefilter("ignore", category=DeprecationWarning) #warnings.simplefilter('ignore') def get_...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Visualizations with Py-ART Step2: Py-ART Colormaps Step3: The RadarDisplay Step4: There are many keyword values we can employe to refine the ...
14,096
<ASSISTANT_TASK:> Python Code: import matplotlib matplotlib.use('nbagg') %matplotlib inline from glob import glob from modulefinder import Module from modulefinder import ModuleFinder from os.path import dirname from pprint import pprint import sys import trace import urllib.request import matplotlib.pyplot as plt fro...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Now we'll bring in the modules we'll be using in this notebook Step2: Now let's get some code we created espeically for this notebook Step3: M...
14,097
<ASSISTANT_TASK:> Python Code: from a301utils.a301_readfile import download import h5py filename = 'MYD021KM.A2016136.2015.006.2016138123353.h5' download(filename) from IPython.display import Image Image(url='http://clouds.eos.ubc.ca/~phil/courses/atsc301/downloads/aqua_136_2015.jpg',width=600) h5_file=h5py.File(file...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Here is the corresponding red,green,blue color composite for the granule. Step2: now use h5py to read some of the satellite channels Step3: h5...
14,098
<ASSISTANT_TASK:> Python Code: !pip freeze %%capture %load_ext autoreload %autoreload 2 import sys sys.path.append('model_management') from model_management.sklearn_model import SklearnModel import numpy as np import pandas as pd import h2o from h2o.automl import H2OAutoML from __future__ import print_function import ...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Load The Dataset Step2: Train a Model Step3: Automatic Machine Learning Step4: Leaderboard Step5: Variable Importances Step6: Best Model vs...
14,099
<ASSISTANT_TASK:> Python Code: from math import sin, cos import matplotlib.pyplot as plt import numpy as np #from __future__ import print_function from ipywidgets import interact, interactive, fixed, interact_manual import ipywidgets as widgets @np.vectorize def any_function(x): return (x)**2 + 3*sin(x) - 4*cos((x)...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step1: Next, we need to find the deviation. A very simple and popular method is using symmetric difference. Step2: Now, we look for an $x$ for which $...