Unnamed: 0
int64
0
16k
text_prompt
stringlengths
149
45.7k
code_prompt
stringlengths
67
140k
100
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Http Response Usage To construct a response packet you have a variety of facilities available. Previously we saw how to parse HTTP responses using Http...
<ASSISTANT_TASK:> Python Code: from proxy.http.parser import HttpParser, httpParserTypes from proxy.common.constants import HTTP_1_1 response = HttpParser(httpParserTypes.RESPONSE_PARSER) response.code = b'200' response.reason = b'OK' response.version = HTTP_1_1 print(response.build_response()) Explanation: Http Respon...
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: Dictionaries A dictionary is datatype that contains a series of key-value pairs. It is similar to a list except for that the indices of the values can ...
<ASSISTANT_TASK:> Python Code: fruit_season = { 'raspberry': 'May', 'apple' : 'September', 'peach' : 'July', 'grape' : 'August' } print(type(fruit_season)) print(fruit_season) Explanation: Dictionaries A dictionary is datatype that contains a series of key-value pairs. It is similar to a list ...
102
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Drive LEDs with the Raspberry Pi GPIO pins This notebook will walk you through using the Raspberry Pi General Purpose Input/Output (GPIO) pins to make ...
<ASSISTANT_TASK:> Python Code: #load GPIO library import RPi.GPIO as GPIO #Set BCM (Broadcom) mode for the pin numbering GPIO.setmode(GPIO.BCM) Explanation: Drive LEDs with the Raspberry Pi GPIO pins This notebook will walk you through using the Raspberry Pi General Purpose Input/Output (GPIO) pins to make a LED light ...
103
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: On-the-fly aluminum potential For the scheme/workflow of the on-the-fly training, please refer to Vandermause et al.. In our FLARE python package, we ...
<ASSISTANT_TASK:> Python Code: import numpy as np from flare.gp import GaussianProcess # make gp model hyps = np.array([0.1, 1, 0.01]) hyp_labels = ['Signal Std', 'Length Scale', 'Noise Std'] cutoffs = {'threebody':3.9} gp = \ GaussianProcess(kernels=['threebody'], hyps=hyps, ...
104
<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: Fully-Connected Neural Nets In the previous homework you implemented a fully-connected two-layer neural network on CIFAR-10. The implementation ...
<ASSISTANT_TASK:> Python Code: # As usual, a bit of setup from __future__ import print_function import time import numpy as np import matplotlib.pyplot as plt from cs231n.classifiers.fc_net import * from cs231n.data_utils import get_CIFAR10_data from cs231n.gradient_check import eval_numerical_gradient, eval_numerical_...
105
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Deploying and Making Predictions with a Trained Model Learning Objectives - Deploy a model on Google CMLE - Make online and batch predictions with a de...
<ASSISTANT_TASK:> Python Code: PROJECT = "cloud-training-demos" # Replace with your PROJECT BUCKET = "cloud-training-bucket" # Replace with your BUCKET REGION = "us-central1" # Choose an available region for Cloud MLE TFVERSION = "1.14" # TF version for CMLE to use import os os.environ["BUCK...
106
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Visualize Glass Brain Step1: 1. Upload all statistical maps into the data folder The data folder can be found in the same folder as this notebook. Jus...
<ASSISTANT_TASK:> Python Code: %matplotlib inline Explanation: Visualize Glass Brain End of explanation stats_file = '../test_data/ALL_N95_Mean_cope2_thresh_zstat1.nii.gz' view = 'ortho' colormap = 'RdBu_r' threshold = '2.3' black_bg Explanation: 1. Upload all statistical maps into the data folder The data folder can ...
107
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Synchronous RVI (sRVI) on the 3-loop problem Step1: For $\alpha=1$, sRVI does not converge on the (periodic) 3-loop problem. Synchronous DVI (sDVI) on...
<ASSISTANT_TASK:> Python Code: alphas = [1.0, 0.999, 0.99, 0.9, 0.7, 0.5, 0.3, 0.1, 0.01, 0.001] max_iters = 50000 epsilon = 0.001 init_v = np.zeros(env.num_states()) init_r_bar_scalar = 0 convergence_flags = np.zeros(alphas.__len__()) for i, alpha in enumerate(alphas): alg = RVI_Evaluation(env, init_v, alpha, ref_...
108
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Transformée de Fourier Step1: TODO Step2: \begin{eqnarray} a_0 & = & \frac{1}{\pi} \int^{\pi}{-\pi} (\cos(t) + 2 \sin(t) - 3 \sin(2t) + 4) \cos(0...
<ASSISTANT_TASK:> Python Code: %matplotlib inline import matplotlib matplotlib.rcParams['figure.figsize'] = (6, 6) import math import cmath # math functions for complex numbers import numpy as np import matplotlib.pyplot as plt import ipywidgets from ipywidgets import interact import sympy as sp # See: http://...
109
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Create Some Fake Entires That demonstrates Plotting In the constructor, give a title, number of total datasets that you want to plot side by side, a li...
<ASSISTANT_TASK:> Python Code: plot = ChristmasPlot('Fake', n_dataset=3, methods=['yass', 'kilosort', 'spyking circus'], logit_y=True, eval_type="Accuracy") for method in plot.methods: for i in range(plot.n_dataset): x = (np.random.rand(30) - 0.5) * 10 y = 1 / (1 + np.exp(-x + np.random.rand())) ...
110
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Introduction to Tethne Step1: Once again, read() accepts a string containing a path to either a single DfR dataset, or a directory containing several....
<ASSISTANT_TASK:> Python Code: from tethne.readers import dfr Explanation: Introduction to Tethne: Working with data from the Web of Science Now that we have the basics down, in this notebook we'll begin working with data from the JSTOR Data-for-Research (DfR) portal. The JSTOR DfR portal gives researchers access to bi...
111
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Title Step1: Load Iris Flower Dataset Step2: Standardize Features Step3: Create Logistic Regression Step4: Train Logistic Regression Step5: Create...
<ASSISTANT_TASK:> Python Code: # Load libraries from sklearn.linear_model import LogisticRegression from sklearn import datasets from sklearn.preprocessing import StandardScaler Explanation: Title: Logistic Regression Slug: logistic_regression Summary: How to train a logistic regression in scikit-learn. Date: 2017-09-2...
112
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: CitiBike Ridership Trends - MBA Data project 2017 Sarah Love Tefiro Kituuka Serunjogi This project endeavors to understand usership trends amongst Citi...
<ASSISTANT_TASK:> Python Code: import sys # system module import pandas as pd # data package import matplotlib as mpl # graphics package import matplotlib.pyplot as plt # graphics module import datetime as dt # date and time module ...
113
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Network analysis of the data. The goal of this notebook is to uncover several constructions inside the dataset which may help us to uncover fraud. With...
<ASSISTANT_TASK:> Python Code: %matplotlib inline import pandas as pd import numpy as np import networkx as nx import matplotlib.pyplot as plt Explanation: Network analysis of the data. The goal of this notebook is to uncover several constructions inside the dataset which may help us to uncover fraud. With that, we can...
114
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Deep Learning Assignment 2 Previously in 1_notmnist.ipynb, we created a pickle with formatted datasets for training, development and testing on the not...
<ASSISTANT_TASK:> Python Code: # These are all the modules we'll be using later. Make sure you can import them # before proceeding further. from __future__ import print_function import numpy as np import tensorflow as tf from six.moves import cPickle as pickle from six.moves import range Explanation: Deep Learning Assi...
115
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Train RNN Here we give a complete example of what using Equinox normally looks like day-to-day. In this example we'll train an RNN to classify clockwis...
<ASSISTANT_TASK:> Python Code: import math import jax import jax.lax as lax import jax.numpy as jnp import jax.random as jrandom import optax # https://github.com/deepmind/optax import equinox as eqx Explanation: Train RNN Here we give a complete example of what using Equinox normally looks like day-to-day. In this ex...
116
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Pesquisar por Tweets Na API Rest também podemos utilizar o método search para procurar por tweets que combinam com o termo definido. O método contém al...
<ASSISTANT_TASK:> Python Code: import tweepy consumer_key = '' consumer_secret = '' access_token = '' access_token_secret = '' autorizar = tweepy.OAuthHandler(consumer_key, consumer_secret) autorizar.set_access_token(access_token, access_token_secret) api = tweepy.API(autorizar) print(api) Explanation: Pesquisar por Tw...
117
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Build a DNN using the Keras Functional API Learning objectives Review how to read in CSV file data using tf.data. Specify input, hidden, and output lay...
<ASSISTANT_TASK:> Python Code: # You can use any Python source file as a module by executing an import statement in some other Python source file # The import statement combines two operations; it searches for the named module, then it binds the # results of that search to a name in the local scope. import os, json, ma...
118
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: How to Build a RuleBasedProfiler This Notebook will demonstrate the steps we need to take to generate a simple RuleBasedProfiler by initializing the co...
<ASSISTANT_TASK:> Python Code: import great_expectations as ge from ruamel import yaml from great_expectations.core.batch import BatchRequest from great_expectations.rule_based_profiler.rule.rule import Rule from great_expectations.rule_based_profiler.rule_based_profiler import RuleBasedProfiler, RuleBasedProfilerResul...
119
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Level 1 In diesem Level werden wir unsere ersten Zeilen Python kennenlernen. Wir werden lernen, was ein integer, ein float, ein string ist, wie wir mit...
<ASSISTANT_TASK:> Python Code: # Für die Standardausgabe benutzen wir die print() Funktion print("Hallo Welt!") # Wir können mit Kommata getrennt auch mehrere Werte ausgeben: print("foo", "bar") # Mit der help() Funktionen zeigen wir uns # die Hilfe der print() Funktion an: help(print) # Ausgabe mit Seperatoren: print(...
120
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: This notebook demonstrates the LeNet model. First we load some dependencies for our code. Step1: Now we can start to define the actual convolution cod...
<ASSISTANT_TASK:> Python Code: import numpy import theano import theano.tensor as T from logistic_sgd import LogisticRegression from mlp import HiddenLayer Explanation: This notebook demonstrates the LeNet model. First we load some dependencies for our code. End of explanation from theano.tensor.signal import downsampl...
121
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Bayesian MLP for MNIST using preconditioned SGLD We use the Jax Bayes library by James Vuckovic to fit an MLP to MNIST using SGD, and SGLD (with RMS...
<ASSISTANT_TASK:> Python Code: %%capture !pip install git+https://github.com/deepmind/dm-haiku !pip install git+https://github.com/jamesvuc/jax-bayes import haiku as hk import jax.numpy as jnp from jax.experimental import optimizers import jax import jax_bayes import sys, os, math, time import numpy as onp import numpy...
122
<SYSTEM_TASK:> Given the following text problem statement, write Python code to implement the functionality described below in problem statement <END_TASK> <USER_TASK:> Problem: I have a csv file which looks like
<ASSISTANT_TASK:> Python Code: from sklearn.cluster import KMeans df = load_data() kmeans = KMeans(n_clusters=2) labels = kmeans.fit_predict(df[['mse']]) <END_TASK>
123
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Control Flow Step1: NOTE on notation * _x, _y, _z, ... Step2: Q5. Given x, return the truth value of NOT x element-wise.
<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() Explanation: Control Flow End of expla...
124
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Parameters and Example Data Step1: True Changepoints Step2: Estimated Changepoints with GFGL smoother Step3: Visualising Graphical Models To visuali...
<ASSISTANT_TASK:> Python Code: y = np.load('../data/y.npy') sigma = np.load('../data/sigma.npy') sigma_inv = np.load('../data/sigma_inv.npy') T = 90 # Steps K = 2 # Changepoints P = 10 # Variables M = 5 # Active Edges eps = 0.000001 # Edge threshold epsilon Explanation: Parameters and Example Data End of explanation ed...
125
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: This notebook will serve to demonstrate Retina functionality within the Jupyter notebook as it relates to Matplotlib. Retina, Matplotlib, and the Jupyt...
<ASSISTANT_TASK:> Python Code: import retina.core.axes import matplotlib.pyplot as plt import numpy as np %matplotlib inline fig = plt.figure() ax1 = plt.subplot('111', projection='Fovea2D') Explanation: This notebook will serve to demonstrate Retina functionality within the Jupyter notebook as it relates to Matplotlib...
126
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Generate a Cubic Lattice with an Interpenetrating Dual Cubic Lattice (Since version 1.6) OpenPNM offers two options for generating dual networks. This...
<ASSISTANT_TASK:> Python Code: import scipy as sp import openpnm as op import matplotlib.pyplot as plt %matplotlib inline wrk = op.Workspace() # Initialize a workspace object wrk.loglevel=50 Explanation: Generate a Cubic Lattice with an Interpenetrating Dual Cubic Lattice (Since version 1.6) OpenPNM offers two options...
127
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Para este exemplo, vamos usar o dataset Iris, que pode ser obtido aqui Step1: Agora, vamos separar os dados entre as medidas e as espécies. Step2: Ag...
<ASSISTANT_TASK:> Python Code: import pandas as pd import numpy as np import matplotlib.pyplot as plt from sklearn import decomposition from sklearn import datasets tabela = pd.read_csv("exemplo_7/iris.data",header=None,sep=',') tabela tabela.columns=['sepal_len', 'sepal_wid', 'petal_len', 'petal_wid', 'class'] tabela ...
128
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Varcode - Quick Start Varcode is a library for working with genomic variant data in Python and predicting the impact of those variants on protein seque...
<ASSISTANT_TASK:> Python Code: from varcode import Variant from pyensembl import ensembl_grch37 Explanation: Varcode - Quick Start Varcode is a library for working with genomic variant data in Python and predicting the impact of those variants on protein sequences. What this means is that this library can help you anno...
129
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Tutorial "Algorithmic Methods for Network Analysis with NetworKit" (Part 4) Determining Important Nodes (cont'd) Betweenness Centrality If you interpre...
<ASSISTANT_TASK:> Python Code: from networkit import * %matplotlib inline cd ~/workspace/NetworKit G = readGraph("input/PGPgiantcompo.graph", Format.METIS) # Code for 7-1) # exact computation # Code for 7-2) # approximate computation Explanation: Tutorial "Algorithmic Methods for Network Analysis with NetworKit" (Part ...
130
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Advanced Pandas Step1: <a id=want></a> The want operator We need to know what we're trying to do -- what we want the data to look like. To borrow a ph...
<ASSISTANT_TASK:> Python Code: import sys # system module import pandas as pd # data package import matplotlib.pyplot as plt # graphics module import datetime as dt # date and time module import numpy as np # foundation for pa...
131
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: <a href="https Step1: DDSP Training This notebook demonstrates the libraries in https Step2: Get a batch of data Step3: Get a distribution strategy ...
<ASSISTANT_TASK:> Python Code: # Copyright 2021 Google LLC. 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 ...
132
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: <a href="http Step1: Make a grid and set boundary conditions. Step2: Here we make the initial grid of elevation of zeros with a very small amount of ...
<ASSISTANT_TASK:> Python Code: # Code block 1 import copy import numpy as np from matplotlib import pyplot as plt from landlab import RasterModelGrid, imshow_grid from landlab.components import ( ChannelProfiler, ChiFinder, FlowAccumulator, SteepnessFinder, StreamPowerEroder, ) from landlab.io impor...
133
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Copyright 2020 The TensorFlow Authors. Step1: TF Lattice 집계 함수 모델 <table class="tfo-notebook-buttons" align="left"> <td><a target="_blank" href="htt...
<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...
134
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Name Data processing by creating a cluster in Cloud Dataproc Label Cloud Dataproc, cluster, GCP, Cloud Storage, KubeFlow, Pipeline Summary A Kubeflow P...
<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 Explanation: Name Data processing by creating a cluster in Cloud Dataproc Label Cloud Dataproc, cluster, GCP, Cloud Storage, KubeFlow, Pipeline S...
135
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: ES-DOC CMIP6 Model Properties - Seaice MIP Era Step1: Document Authors Set document authors Step2: Document Contributors Specify document contributor...
<ASSISTANT_TASK:> Python Code: # DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'miroc', 'sandbox-3', 'seaice') Explanation: ES-DOC CMIP6 Model Properties - Seaice MIP Era: CMIP6 Institute: MIROC Source ID: SANDBOX-3 Topic: Seaice Sub-Topics: Dyn...
136
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Build a fraud detection model on Vertex AI Step1: <table align="left"> <td> <a href="https Step2: Install the latest version of the Vertex AI c...
<ASSISTANT_TASK:> Python Code: # Copyright 2022 Google LLC # # 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 applicabl...
137
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Gradient Checking Welcome to the final assignment for this week! In this assignment you will learn to implement and use gradient checking. You are par...
<ASSISTANT_TASK:> Python Code: # Packages import numpy as np from testCases import * from gc_utils import sigmoid, relu, dictionary_to_vector, vector_to_dictionary, gradients_to_vector Explanation: Gradient Checking Welcome to the final assignment for this week! In this assignment you will learn to implement and use gr...
138
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Copyright 2020 The TensorFlow Probability Authors. Licensed under the Apache License, Version 2.0 (the "License"); Step1: TensorFlow Probability on JA...
<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...
139
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Introduction to BigQuery ML - Predict Birth Weight Learning Objectives Use BigQuery to explore the natality dataset Create a regression (linear regress...
<ASSISTANT_TASK:> Python Code: import matplotlib.pyplot as plt Explanation: Introduction to BigQuery ML - Predict Birth Weight Learning Objectives Use BigQuery to explore the natality dataset Create a regression (linear regression) model in BQML Evaluate the performance of your machine learning model Make predictions w...
140
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: SETUP Step1: Autosipper Step2: Manifold Step3: Micromanager Step4: Preset Step5: ACQUISITION Step6: MM Get info Step7: Video Step8: SNAP CV2 St...
<ASSISTANT_TASK:> Python Code: import time import numpy as np import matplotlib.pyplot as plt import pandas as pd %matplotlib inline Explanation: SETUP End of explanation # config directory must have "__init__.py" file # from the 'config' directory, import the following classes: from config import Motor, ASI_Controller...
141
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: These examples are tests for scc_info on alternating automata. Step1: universal edges are handled as if they were many distinct existencial edges from...
<ASSISTANT_TASK:> Python Code: from IPython.display import display import spot spot.setup(show_default='.bas') spot.automaton(''' HOA: v1 States: 2 Start: 0&1 AP: 2 "a" "b" acc-name: Buchi Acceptance: 1 Inf(0) --BODY-- State: 0 [0] 0 [!0] 1 State: 1 [1] 1 {0} --END-- ''') Explanation: These examples are tests for scc_i...
142
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Course 12-752 Step1: Section 2 Step2: Section 3 Step3: Display variable power Step4: Use parser function from dateutil module to convert the timest...
<ASSISTANT_TASK:> Python Code: import numpy as np import pandas as pd import matplotlib.pyplot as plt import datetime as dt import scipy.spatial.distance as dist %matplotlib inline Explanation: Course 12-752: Term Project Project Title: Comparison of the accuracy of linear regression model based on the granularity of d...
143
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: This notebook was prepared by Donne Martin. Source and license info is on GitHub. Spark IPython Notebook Setup Python Shell DataFrames RDDs Pair RDDs R...
<ASSISTANT_TASK:> Python Code: !pyspark Explanation: This notebook was prepared by Donne Martin. Source and license info is on GitHub. Spark IPython Notebook Setup Python Shell DataFrames RDDs Pair RDDs Running Spark on a Cluster Viewing the Spark Application UI Working with Partitions Caching RDDs Checkpointing RDDs W...
144
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Random Variables Frequently, when an experiment is performed, we are interested mainly in some function of the outcome as opposed to the actual outcome...
<ASSISTANT_TASK:> Python Code: %matplotlib inline import numpy as np import pandas as pd from itertools import product # from IPython.core.display import HTML # css = open('media/style-table.css').read() + open('media/style-notebook.css').read() # HTML('<style>{}</style>'.format(css)) one_toss = np.array(['H', 'T']) tw...
145
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: DBSCAN Lab 在此 notebook 中,我们将使用 DBSCAN 来聚集几个数据集。我们将研究更改参数(ε 和 min_samples)会如何更改生成的聚类结构。 Step1: 下面是第一个数据集: Step2: 我们使用 DBSCAN 的默认设置对其进行聚类,看看会发生什么。我们希望它...
<ASSISTANT_TASK:> Python Code: import pandas as pd dataset_1 = pd.read_csv('blobs.csv')[:80].values Explanation: DBSCAN Lab 在此 notebook 中,我们将使用 DBSCAN 来聚集几个数据集。我们将研究更改参数(ε 和 min_samples)会如何更改生成的聚类结构。 End of explanation %matplotlib inline import dbscan_lab_helper as helper helper.plot_dataset(dataset_1) Explanation...
146
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: <h1>Table of Contents<span class="tocSkip"></span></h1> <div class="toc"><ul class="toc-item"><li><span><a href="#Introduction" data-toc-modified-id="I...
<ASSISTANT_TASK:> Python Code: debug_flag = False Explanation: <h1>Table of Contents<span class="tocSkip"></span></h1> <div class="toc"><ul class="toc-item"><li><span><a href="#Introduction" data-toc-modified-id="Introduction-1"><span class="toc-item-num">1&nbsp;&nbsp;</span>Introduction</a></span></li><li><span><a hre...
147
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Predicting house prices using k-nearest neighbors regression In this notebook, you will implement k-nearest neighbors regression. You will Step1: Load...
<ASSISTANT_TASK:> Python Code: import sys sys.path.append('C:\Anaconda2\envs\dato-env\Lib\site-packages') import graphlab Explanation: Predicting house prices using k-nearest neighbors regression In this notebook, you will implement k-nearest neighbors regression. You will: * Find the k-nearest neighbors of a given q...
148
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Release of hammer-cli gem Requirements push access to https Step1: Update the following notebook settings Step2: Ensure the repo is up to date Step3:...
<ASSISTANT_TASK:> Python Code: %cd .. Explanation: Release of hammer-cli gem Requirements push access to https://github.com/theforeman/hammer-cli push access to rubygems.org for hammer-cli sudo yum install transifex-client python-slugify asciidoc ensure neither the git push or gem push don't require interractive auth. ...
149
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Arrays for Numerical work? Step2: You can see, adding two lists just results in a longer list, catenation of the two.
<ASSISTANT_TASK:> Python Code: a = [1,2,3] b = [4,5,6] c = a+b print(c) Explanation: Arrays for Numerical work? End of explanation a.append(b) print(a) def sum(data): sum the elements of an array asum = 0.0 for i in data: asum = asum + i return asum # the length of the array is defined her...
150
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: View in Colaboratory <img height="60" width="120" src="https Step1: visit http Step2: What happen when we change the tree depth? Step3: Try by yours...
<ASSISTANT_TASK:> Python Code: import pandas as pd from sklearn.preprocessing import Imputer from sklearn import tree from sklearn import metrics import numpy as np import matplotlib.pyplot as plt % matplotlib inline #train_df = pd.read_csv("titanic.csv") #test_df = pd.read_csv("titanic_test.csv") from google.colab imp...
151
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Pandas Crash Course <img style="float Step1: Pandas Series and DataFrame objects There are two main data structures in pandas Step2: Dataframes use t...
<ASSISTANT_TASK:> Python Code: # Python imports import pandas as pd import numpy as np import matplotlib as mpl import matplotlib.pyplot as plt Explanation: Pandas Crash Course <img style="float: right; border:3px solid black" src="images/10_Panda_DailyMail_7_Nov_2013.jpg" border="5" width=30%> Pandas is a Python packa...
152
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: <h2 align="center">点击下列图标在线运行HanLP</h2> <div align="center"> <a href="https Step1: 加载模型 HanLP的工作流程是先加载模型,模型的标示符存储在hanlp.pretrained这个包中,按照NLP任务归类。 ...
<ASSISTANT_TASK:> Python Code: !pip install hanlp -U Explanation: <h2 align="center">点击下列图标在线运行HanLP</h2> <div align="center"> <a href="https://colab.research.google.com/github/hankcs/HanLP/blob/doc-zh/plugins/hanlp_demo/hanlp_demo/zh/pos_stl.ipynb" target="_blank"><img src="https://colab.research.google.com/assets...
153
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Tutorial Outline Introduction Preprerequisites How does it work? Authentication Authentication keys MongoDB Collection Starting a Stream Stream Listen...
<ASSISTANT_TASK:> Python Code: import numpy as np import pandas as pd import tweepy import matplotlib.pyplot as plt import pymongo import ipywidgets as wgt from IPython.display import display from sklearn.feature_extraction.text import CountVectorizer import re from datetime import datetime %matplotlib inline Explanati...
154
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Ejemplo cuencas En el siguiente ejemplo se presentan las funcionalidades básicas de la herramienta wmf.Stream y wmf.Basin dentro de los temas tocados s...
<ASSISTANT_TASK:> Python Code: #Paquete Watershed Modelling Framework (WMF) para el trabajo con cuencas. from wmf import wmf Explanation: Ejemplo cuencas En el siguiente ejemplo se presentan las funcionalidades básicas de la herramienta wmf.Stream y wmf.Basin dentro de los temas tocados se presenta: Trazado de corrient...
155
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: HTTPX <img src="https Step1: Using httpbin.org
<ASSISTANT_TASK:> Python Code: from datetime import datetime Explanation: HTTPX <img src="https://raw.githubusercontent.com/encode/httpx/master/docs/img/butterfly.png" alt="HTTPX Logo" style="width: 400px;"/> https://www.python-httpx.org/ A next-generation HTTP client for Python. HTTPX is a fully featured HTTP client f...
156
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: <table> <tr align=left><td><img align=left src="../images/CC-BY.png"> <td>Text provided under a Creative Commons Attribution license, CC-BY. All code...
<ASSISTANT_TASK:> Python Code: %matplotlib inline import numpy import matplotlib.pyplot as plt Explanation: <table> <tr align=left><td><img align=left src="../images/CC-BY.png"> <td>Text provided under a Creative Commons Attribution license, CC-BY. All code is made available under the FSF-approved MIT license. (c) Ma...
157
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: <center> <img src="../../img/ods_stickers.jpg"> Открытый курс по машинному обучению. Сессия №3 <center>Автор материала Step1: Здесь у нас текст вопрос...
<ASSISTANT_TASK:> Python Code: !head -1 hw8_data/stackoverflow.10kk.tsv !head -1 hw8_data/stackoverflow_10mln.tsv Explanation: <center> <img src="../../img/ods_stickers.jpg"> Открытый курс по машинному обучению. Сессия №3 <center>Автор материала: программист-исследователь Mail.Ru Group Юрий Кашницкий <center> Домашнее ...
158
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Tutorial "Algorithmic Methods for Network Analysis with NetworKit" (Part 3) Determining Important Nodes There are a number of ways to measure the impor...
<ASSISTANT_TASK:> Python Code: from networkit import * %matplotlib inline cd ~/workspace/NetworKit G = readGraph("input/MIT8.edgelist", Format.EdgeListTabZero) # Code for 3-3) and 3-4) %matplotlib inline import matplotlib.pyplot as plt # def avgFriendDegree(v): count = 0 # count the number of persons whose friends have...
159
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Experiment Step1: Load and check data Step2: ## Analysis Experiment Details Step3: Plot accuracy over epochs
<ASSISTANT_TASK:> Python Code: %load_ext autoreload %autoreload 2 from __future__ import absolute_import from __future__ import division from __future__ import print_function import os import glob import tabulate import pprint import click import numpy as np import pandas as pd from ray.tune.commands import * from nupi...
160
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Copyright 2018 Google LLC. Step1: Cat vs. Dog Image Classification Exercise 2 Step2: These are just a few of the options available (for more, see the...
<ASSISTANT_TASK:> Python Code: # 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, sof...
161
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Example 1 Step1: Load time series data Step2: There are a few supported file formats. AT2 files can be loaded as follows Step3: Create site profile...
<ASSISTANT_TASK:> Python Code: import matplotlib.pyplot as plt import numpy as np import pysra %matplotlib inline # Increased figure sizes plt.rcParams["figure.dpi"] = 120 Explanation: Example 1 : Time series SRA Time series analysis to compute surface response spectrum and site amplification functions. End of explana...
162
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Function Approximation with a Multilayer Perceptron This code is provided as supplementary material of the lecture Machine Learning and Optimization in...
<ASSISTANT_TASK:> Python Code: import numpy as np import matplotlib.pyplot as plt from sklearn.preprocessing import MinMaxScaler function_select = 5 def myfun(x): functions = { 1: np.power(x,2), # quadratic function 2: np.sin(x), # sinus 3: np.sign(x), # signum 4: np.exp(x), # expone...
163
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Handwritten Number Recognition with TFLearn and MNIST In this notebook, we'll be building a neural network that recognizes handwritten numbers 0-9. Th...
<ASSISTANT_TASK:> Python Code: # Import Numpy, TensorFlow, TFLearn, and MNIST data import numpy as np import tensorflow as tf import tflearn import tflearn.datasets.mnist as mnist Explanation: Handwritten Number Recognition with TFLearn and MNIST In this notebook, we'll be building a neural network that recognizes hand...
164
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Data BootCamp Project Step1: Who has Grit? Hockey has always been a eloquent yet brutal sport, in this analysis I'm finding the player that embodies t...
<ASSISTANT_TASK:> Python Code: import pandas as pd #PandasPandas %matplotlib inline import matplotlib.pyplot as plt import numpy as np print('PandaPandaPanda ', pd.__version__) df=pd.read_csv('NHLQUANT.csv') Explanation: Data BootCamp Project End of explanation plt.plot(df.index,df['Grit']) Explanation: Who has Grit? H...
165
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: This IPython Notebook illustrates the use of the openmc.mgxs.Library class. The Library class is designed to automate the calculation of multi-group cr...
<ASSISTANT_TASK:> Python Code: %matplotlib inline import math import matplotlib.pyplot as plt import numpy as np import openmc import openmc.mgxs Explanation: This IPython Notebook illustrates the use of the openmc.mgxs.Library class. The Library class is designed to automate the calculation of multi-group cross sectio...
166
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Copyright 2020 The TensorFlow Authors. Step1: データ増強 <table class="tfo-notebook-buttons" align="left"> <td><a target="_blank" href="https Step2: データ...
<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...
167
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Copyright 2019 The TensorFlow Authors. Step1: Get started with TensorBoard <table class="tfo-notebook-buttons" align="left"> <td> <a target="_bl...
<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...
168
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Compare the different ICA algorithms in MNE Different ICA algorithms are fit to raw MEG data, and the corresponding maps are displayed. Step1: Read an...
<ASSISTANT_TASK:> Python Code: # Authors: Pierre Ablin <pierreablin@gmail.com> # # License: BSD (3-clause) from time import time import mne from mne.preprocessing import ICA from mne.datasets import sample print(__doc__) Explanation: Compare the different ICA algorithms in MNE Different ICA algorithms are fit to raw ME...
169
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Converting $\LaTeX$ to <span style="font-variant Step1: Now data contains the text that is stored in this file. Step2: Let us look at the output file...
<ASSISTANT_TASK:> Python Code: with open('example.tex') as f: data = f.read() Explanation: Converting $\LaTeX$ to <span style="font-variant:small-caps;">Html</span> The purpose of the following exercise is to implement a translator from $\LaTeX$ to MathML. $\LaTeX$ is a document markup language that is especially...
170
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Moving through a physical experience Some examples of IoT application that ping a digital twin This doc does not really teach anything new, but it will...
<ASSISTANT_TASK:> Python Code: from azure.identity import AzureCliCredential from azure.digitaltwins.core import DigitalTwinsClient # using yaml instead of import yaml import uuid # using altair instead of matplotlib for vizuals import numpy as np import pandas as pd # you will get this from the ADT resource at portal...
171
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Structures like these are encoded in "PDB" files Entries are determined by columns in the file, not by spaces between the columns Step1: Predict what ...
<ASSISTANT_TASK:> Python Code: #record atom_name chain x y z occupancy atom_type # | | | | | | | | #ATOM 1086 CG LYS A 141 -4.812 9.683 2.584 1.00 26.78 N0 # | | | ...
172
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Sentiment Classification & How To "Frame Problems" for a Neural Network by Andrew Trask Twitter Step1: Note Step2: Lesson Step3: Project 1 Step4: W...
<ASSISTANT_TASK:> Python Code: def pretty_print_review_and_label(i): print(labels[i] + "\t:\t" + reviews[i][:80] + "...") g = open('reviews.txt','r') # What we know! reviews = list(map(lambda x:x[:-1],g.readlines())) g.close() g = open('labels.txt','r') # What we WANT to know! labels = list(map(lambda x:x[:-1].uppe...
173
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Performance Benchmarking for KV Drive The goal of these set of experiments is to characterize the variability across platforms in a systematic and cons...
<ASSISTANT_TASK:> Python Code: %matplotlib inline import pandas as pd import random import matplotlib.pyplot as plt import numpy as np import seaborn as sns pd.set_option("display.max_rows", 8) Explanation: Performance Benchmarking for KV Drive The goal of these set of experiments is to characterize the variability acr...
174
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: The first step in any data analysis is acquiring and munging the data Our starting data set can be found here Step1: Problems Step2: Problems Step3: ...
<ASSISTANT_TASK:> Python Code: running_id = 0 output = [[0]] with open("E:/output.txt") as file_open: for row in file_open.read().split("\n"): cols = row.split(",") if cols[0] == output[-1][0]: output[-1].append(cols[1]) output[-1].append(True) else: outpu...
175
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Batch Normalization – Practice Batch normalization is most useful when building deep neural networks. To demonstrate this, we'll create a convolutional...
<ASSISTANT_TASK:> Python Code: import tensorflow as tf from tensorflow.examples.tutorials.mnist import input_data mnist = input_data.read_data_sets("MNIST_data/", one_hot=True, reshape=False) Explanation: Batch Normalization – Practice Batch normalization is most useful when building deep neural networks. To demonstrat...
176
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> 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 ne...
<ASSISTANT_TASK:> 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 b...
177
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Singular value decomposition (SVD) The singular value decompostion of a real-valued $m \times n$ matrix $\boldsymbol{A}$ is Step1: Note Step2: Perfor...
<ASSISTANT_TASK:> Python Code: %matplotlib inline import matplotlib import matplotlib.pyplot as plt import numpy as np from PIL import Image Explanation: Singular value decomposition (SVD) The singular value decompostion of a real-valued $m \times n$ matrix $\boldsymbol{A}$ is: $$ \boldsymbol{A} = \boldsymbol{U} \bolds...
178
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: <a id='top'> </a> Author Step1: Cosmic-ray composition effective area analysis Table of contents Load simulation DataFrame and apply quality cuts Defi...
<ASSISTANT_TASK:> Python Code: %load_ext watermark %watermark -u -d -v -p numpy,matplotlib,scipy,pandas,sklearn,mlxtend Explanation: <a id='top'> </a> Author: James Bourbeau End of explanation %matplotlib inline from __future__ import division, print_function from collections import defaultdict import os import numpy a...
179
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Working with events This tutorial describes event representation and how event arrays are used to subselect data. As usual we'll start by importing the...
<ASSISTANT_TASK:> Python Code: import os import numpy as np import mne sample_data_folder = mne.datasets.sample.data_path() sample_data_raw_file = os.path.join(sample_data_folder, 'MEG', 'sample', 'sample_audvis_raw.fif') raw = mne.io.read_raw_fif(sample_data_raw_file, verbose=False)...
180
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Plotting a builtin waveform In the tools sub-package is a module called plot_source_wave which can be used to plot any of the builtin waveforms in time...
<ASSISTANT_TASK:> Python Code: %matplotlib inline from gprMax.waveforms import Waveform from tools.plot_source_wave import check_timewindow, mpl_plot w = Waveform() w.type = 'ricker' w.amp = 1 w.freq = 25e6 timewindow = 300e-9 dt = 8.019e-11 timewindow, iterations = check_timewindow(timewindow, dt) plt = mpl_plot(w, ti...
181
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Data Both datasets are text collections from this site. TCP-ECCO (170mb uncompressed) can be downloaded here Lincoln (700kb uncompressed) can be downl...
<ASSISTANT_TASK:> Python Code: def get_lincoln(): for filepath in sorted(glob.glob('Lincoln/*.txt')): with open(filepath, 'r', encoding='latin') as f: doc = f.read() yield {'filepath': filepath, 'doc': doc} def get_TCP(): for filepath in sorted(glob.glob('TCP-ECCO/*.txt')): ...
182
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Sparse Linear Inverse Demo with AMP In this demo, we illustrate how to use the vampyre package for a simple sparse linear inverse problem. The proble...
<ASSISTANT_TASK:> Python Code: import os import sys vp_path = os.path.abspath('../../') if not vp_path in sys.path: sys.path.append(vp_path) import vampyre as vp Explanation: Sparse Linear Inverse Demo with AMP In this demo, we illustrate how to use the vampyre package for a simple sparse linear inverse problem. ...
183
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Linear Elasticity in 2D for 3 Phases Introduction This example provides a demonstration of using PyMKS to compute the linear strain field for a three-p...
<ASSISTANT_TASK:> Python Code: %matplotlib inline %load_ext autoreload %autoreload 2 import numpy as np import matplotlib.pyplot as plt n = 21 n_phases = 3 from pymks.tools import draw_microstructures from pymks.datasets import make_delta_microstructures X_delta = make_delta_microstructures(n_phases=n_phases, size=(n, ...
184
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: The selectors module provides a platform-independent abstraction layer on top of the platform-specific I/O monitoring functions in select. Operating Mo...
<ASSISTANT_TASK:> Python Code: # %load selectors_echo_server.py import selectors import socket mysel = selectors.DefaultSelector() keep_running = True def read(connection, mask): "Callback for read events" global keep_running client_address = connection.getpeername() print('read({})'.format(client_addre...
185
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Face verification Goals train a network for face similarity using triplet loss work data augmentation, generators and hard negative mining Dataset We w...
<ASSISTANT_TASK:> Python Code: import tensorflow as tf # If you have a GPU, execute the following lines to restrict the amount of VRAM used: gpus = tf.config.experimental.list_physical_devices('GPU') if len(gpus) > 1: print("Using GPU {}".format(gpus[0])) tf.config.experimental.set_visible_devices(gpus[0], 'GPU...
186
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: ES-DOC CMIP6 Model Properties - Ocnbgchem MIP Era Step1: Document Authors Set document authors Step2: Document Contributors Specify document contribu...
<ASSISTANT_TASK:> Python Code: # DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'mri', 'sandbox-3', 'ocnbgchem') Explanation: ES-DOC CMIP6 Model Properties - Ocnbgchem MIP Era: CMIP6 Institute: MRI Source ID: SANDBOX-3 Topic: Ocnbgchem Sub-Topics...
187
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Logistic Regression with L2 regularization In this notebook, you will implement your own logistic regression classifier with L2 regularization. You wil...
<ASSISTANT_TASK:> Python Code: import os import zipfile import string import numpy as np import pandas as pd from sklearn import linear_model from sklearn.feature_extraction.text import CountVectorizer import matplotlib.pyplot as plt %matplotlib inline Explanation: Logistic Regression with L2 regularization In this not...
188
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Text Classification with spaCy This walkthrough is based on this spaCy tutorial. Train a convolutional neural network text classifier on the IMDB datas...
<ASSISTANT_TASK:> Python Code: # Python >3.5 !pip install verta !pip install spacy==2.1.6 !python -m spacy download en Explanation: Text Classification with spaCy This walkthrough is based on this spaCy tutorial. Train a convolutional neural network text classifier on the IMDB dataset, using the TextCategorizer compone...
189
<SYSTEM_TASK:> Given the following text problem statement, write Python code to implement the functionality described below in problem statement <END_TASK> <USER_TASK:> Problem: Say I have two dataframes:
<ASSISTANT_TASK:> Python Code: import pandas as pd df1 = pd.DataFrame({'Timestamp': ['2019/04/02 11:00:01', '2019/04/02 11:00:15', '2019/04/02 11:00:29', '2019/04/02 11:00:30'], 'data': [111, 222, 333, 444]}) df2 = pd.DataFrame({'Timestamp': ['2019/04/02 11:00:14', '2019/04/02 11:00:15', '2019/04/02...
190
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: 2A.data - Classification, régression, anomalies - énoncé Le jeu de données Wine Quality Data Set contient 5000 vins décrits par leurs caractéristiques ...
<ASSISTANT_TASK:> Python Code: %matplotlib inline import matplotlib.pyplot as plt from jyquickhelper import add_notebook_menu add_notebook_menu() Explanation: 2A.data - Classification, régression, anomalies - énoncé Le jeu de données Wine Quality Data Set contient 5000 vins décrits par leurs caractéristiques chimiques ...
191
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Why Violin Plots are Awesome for Feature Engineering Using NLP to Identify Similar Products At Wayfair, technology and data expertise enable data scien...
<ASSISTANT_TASK:> Python Code: %matplotlib inline import pandas as pd import seaborn as sns import matplotlib.pyplot as plt from fuzzywuzzy import fuzz import numpy as np # some settings to be used throughout the notebook pd.set_option('max_colwidth', 70) wf_colors = ["#C7DEB1","#9763A4"] # make some fake data for a de...
192
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Text Data Explanation Benchmarking Step1: Load Data and Model Step2: Class Label Mapping Step3: Define Score Function Step4: Create Explainer Objec...
<ASSISTANT_TASK:> Python Code: import copy import pandas as pd import numpy as np import matplotlib.pyplot as plt from transformers import AutoTokenizer, AutoModelForSequenceClassification import shap.benchmark as benchmark import shap import scipy as sp import nlp import torch pd.set_option('display.max_columns', None...
193
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Principal Component Analysis with Iris Dataset Step1: Load Iris dataset The Iris Dataset here. This data sets consists of 3 different types of irises’...
<ASSISTANT_TASK:> Python Code: from sklearn import datasets from sklearn.decomposition import PCA import pandas as pd import matplotlib.pyplot as plt import seaborn as sns from mpl_toolkits.mplot3d import Axes3D # %matplotlib inline %matplotlib notebook Explanation: Principal Component Analysis with Iris Dataset End of...
194
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Notebook 3.3 Step1: Newick tree files We learned in notebook 3.2 that the file format to store phylogenetic trees is simply a text file containing a s...
<ASSISTANT_TASK:> Python Code: import toytree Explanation: Notebook 3.3: Newick Assignment Complete the notebook then download as an HTML file (toolbar -&gt; File -&gt; Download as) and submit your assignment by emailing to Natalie (natalie.niepoth@columbia.edu). End of explanation newick = "((a,b),(c, d));" tre = toyt...
195
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: ES-DOC CMIP6 Model Properties - Ocnbgchem MIP Era Step1: Document Authors Set document authors Step2: Document Contributors Specify document contribu...
<ASSISTANT_TASK:> Python Code: # DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'thu', 'sandbox-2', 'ocnbgchem') Explanation: ES-DOC CMIP6 Model Properties - Ocnbgchem MIP Era: CMIP6 Institute: THU Source ID: SANDBOX-2 Topic: Ocnbgchem Sub-Topics...
196
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Manuscript4 - Computational Model -- Group-level for Fig. 4 Master code for Ito et al., 2017¶ Takuya Ito (takuya.ito@rutgers.edu) The model (see Stern ...
<ASSISTANT_TASK:> Python Code: import numpy as np import matplotlib.pyplot as plt from scipy import sparse % matplotlib inline import scipy.stats as stats import statsmodels.api as sm import CompModel_v7 as cm cm = reload(cm) import multiprocessing as mp import sklearn.preprocessing as preprocessing import sklearn.svm ...
197
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: A simple python application Step1: 1.- Introduction to Python dictionaries In this practice we will extensively use Python Dictionaries, in this preli...
<ASSISTANT_TASK:> Python Code: import goslate # pip install goslate from bs4 import BeautifulSoup # pip install beautifulsoup4 import urllib2 # pip install requests Explanation: A simple python application: universal translator In this lab we will develop a universal text translator by using the Google translation web...
198
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: <a href="http Step1: The class <code>plot_error_surfaces</code> is just to help you visualize the data space and the parameter space during training a...
<ASSISTANT_TASK:> Python Code: # Import the libraries we need for this lab import numpy as np import matplotlib.pyplot as plt from mpl_toolkits import mplot3d import torch from torch.utils.data import Dataset, DataLoader import torch.nn as nn Explanation: <a href="http://cocl.us/pytorch_link_top"> <img src="https:...
199
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Python Libraries For Better Code Insights Snoop - Never Use print Again Step1: Snooping on execution Step2: Snooping on referenced functions Step3: ...
<ASSISTANT_TASK:> Python Code: ROMAN = [ (1000, "M"), ( 900, "CM"), ( 500, "D"), ( 400, "CD"), ( 100, "C"), ( 90, "XC"), ( 50, "L"), ( 40, "XL"), ( 10, "X"), ( 9, "IX"), ( 5, "V"), ( 4, "IV"), ( 1, "I"), ] def to_roman(number: int): result = "" for...