Unnamed: 0
int64
0
15.9k
cleaned_code
stringlengths
67
124k
cleaned_prompt
stringlengths
168
30.3k
7,400
<ASSISTANT_TASK:> Python Code: # Versão da Linguagem Python from platform import python_version print('Versão da Linguagem Python Usada Neste Jupyter Notebook:', python_version()) # Imports import pandas as pd import numpy as np # Carrega o arquivo load_file = "dados_compras.json" purchase_file = pd.read_json(load_fil...
<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: Missão Step2: Informações Sobre os Consumidores Step3: Análise Geral de Compras Step4: Análise Demográfica Step5: Informações Demográficas P...
7,401
<ASSISTANT_TASK:> Python Code: %matplotlib inline import compare from compare import load_sourmash_csv # File name load_sourmash_csv('SRR606249.pe.trim2and30_comparison.k51.csv') from compare import create_cluster_map #Input file name, output image name, title create_cluster_map("SRR606249.pe.trim2and30_comparison.k...
<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, import the compare module Step2: Then load and visulalize the table
7,402
<ASSISTANT_TASK:> Python Code: %matplotlib inline import matplotlib.pyplot as plt import seaborn as sns sns.set() from collections import defaultdict from ICGC_data_parser import SSM_Reader distribution = defaultdict(list) for record in SSM_Reader(filename='data/ssm_sample.vcf'): # Associate CHROMOSOME -> [MUTATIO...
<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 want to plot the distribution of the mutations along the chromosomes, so, we first read the positions of the mutations (read from a random sa...
7,403
<ASSISTANT_TASK:> Python Code: import numpy as np import pandas as pd from pandas_profiling import ProfileReport from scipy import stats from sklearn.ensemble import RandomForestRegressor from sklearn.compose import ColumnTransformer from sklearn.model_selection import train_test_split, cross_val_score, GridSearchCV fr...
<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: Chicago taxi fare training experience Step2: Query dataset Step3: Column info Step4: Raw descriptive statistics Step5: Feature engineering S...
7,404
<ASSISTANT_TASK:> Python Code: import pandas as pd import numpy as np from gypsy.GYPSYNonSpatial import GrossTotalVolume_Pl GrossTotalVolume_Pl(np.random.random(10) * 100, np.random.random(10) * 100) def GrossTotalVolume_Pl_arr(BA_Pl, topHeight_Pl): a1 = 0.194086 a2 = 0.988276 a3 = 0.949346 a4 = -3.39...
<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 original gross volume function checks that top height is greater than 0 Step2: MWEs Step3: Timings Step4: The array method is 20x faster....
7,405
<ASSISTANT_TASK:> Python Code: %matplotlib inline import matplotlib.pyplot as plt from random import choice, seed from mpl_toolkits.mplot3d import axes3d import numpy as np from ipywidgets import interact seed(333) data = [((-2, 3), 1), ((-1, -1), -1), (( 2, -3), 1)] weights = [1, 1] n_iterations = 1...
<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 code demonstrates that the sum of the weights approach one over time. Step2: Next, here is a 3D surface chart that you can move using the ...
7,406
<ASSISTANT_TASK:> Python Code: %matplotlib inline import matplotlib.pyplot as plt import numpy as np from IPython.display import Image from IPython.html.widgets import interact, interactive, fixed Image('fermidist.png') def fermidist(energy, mu, kT): e = 2.71828182845904523536028747135266249775724709369995 Co...
<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: Exploring the Fermi distribution Step3: In this equation Step4: Write a function plot_fermidist(mu, kT) that plots the Fermi distribution $F(\...
7,407
<ASSISTANT_TASK:> Python Code: # Create pkg_cache and environments pkg_cache = cache.packages(root_pkgs) envs = environment.environments(root_envs) print(pkg_cache[:5]) print() print(envs[:5]) pi = pkg_cache[0] pi.index # info/index.json # We can access fields of index.json directly from the object. pi.name, pi.versi...
<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: Packages Step2: Environments Step3: Neat stuff
7,408
<ASSISTANT_TASK:> Python Code: # List of Strings to a String listOfStrings = ['One', 'Two', 'Three'] strOfStrings = ''.join(listOfStrings) print(strOfStrings) # List Of Integers to a String listOfNumbers = [1, 2, 3] strOfNumbers = ''.join(str(n) for n in listOfNumbers) print(strOfNumbers) helloWorld = ['hello','world'...
<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: Convert A List To A Tuple Step2: Note that the second element that is passed to the zip() function makes use of the step value to make sure tha...
7,409
<ASSISTANT_TASK:> Python Code: name=str(input('your name:')) month=int(input('your birth month:')) day=int(input('your birth day')) if month==1 and day<21: print(name,'你是摩羯座!') if month==12 and day>21: print(name,'你是摩羯座!') if month==2 and day<19: print(name,'你是水瓶座!') if month==1 and day>20: print(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: 写程序,可由键盘读入两个整数m与n(n不等于0),询问用户意图,如果要求和则计算从m到n的和输出,如果要乘积则计算从m到n的积并输出,如果要求余数则计算m除以n的余数的值并输出,否则则计算m整除n的值并输出。 Step2: 写程序,能够根据北京雾霾PM2.5数值给出对应的防护建议。如当...
7,410
<ASSISTANT_TASK:> Python Code: %matplotlib inline %config InlineBackend.figure_format = 'retina' import numpy as np import pandas as pd import matplotlib.pyplot as plt data_path = 'Bike-Sharing-Dataset/hour.csv' rides = pd.read_csv(data_path) rides.head() rides[:24*10].plot(x='dteday', y='cnt') dummy_fields = ['seas...
<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 and prepare the data Step2: Checking out the data Step3: Dummy variables Step4: Scaling target variables Step5: Splitting the data into...
7,411
<ASSISTANT_TASK:> Python Code: # DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'hammoz-consortium', 'sandbox-2', 'ocnbgchem') # Set as follows: DOC.set_author("name", "email") # TODO - please enter value(s) # Set as follows: DOC.set_contribu...
<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...
7,412
<ASSISTANT_TASK:> Python Code: import datetime as dt print("Maintenant naif :", dt.datetime.now()) instant = dt.datetime.now(dt.timezone(dt.timedelta(hours=2))) print("Maintenant aware :", instant) print("Info timezone :", instant.tzinfo) instant = dt.datetime.now(dt.timezone(dt.timedelta(hours=2), name="France")) ...
<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: Avec la librairie pytz Step2: Les valeurs possibles pour les timezone sont fournies par une constante. Step3: Nous créons d'abord une date nai...
7,413
<ASSISTANT_TASK:> Python Code: # Install apache-beam with pip. !pip install --quiet apache-beam import apache_beam as beam def human_readable_window(window) -> str: Formats a window object into a human readable string. if isinstance(window, beam.window.GlobalWindow): return str(window) return f'{window.start...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step4: First, lets define some helper functions to simplify the rest of the examples. Step6: Now lets create some data to use in the examples. Step7: ...
7,414
<ASSISTANT_TASK:> Python Code: # iterable objecct retuns iterator to iter() function s = 'abc' itr = iter(s) print(next(itr)) print(next(itr)) print(next(itr)) ## __iter__() function and __next__() function can be called directly as well x = s.__iter__() print(x.__next__()) print(next(x)) # StopIteration signal is rais...
<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: Creating iterable object Step3: Generator
7,415
<ASSISTANT_TASK:> Python Code: from __future__ import print_function from ipywidgets import interact, interactive, fixed, interact_manual import ipywidgets as widgets def f(x): return x interact(f, x=10); interact(f, x=True); interact(f, x='Hi there!'); @interact(x=True, y=1.0) def g(x, y): return (x, y) ...
<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 interact Step2: When you pass this function as the first argument to interact along with an integer keyword argument (x=10), a slider is ...
7,416
<ASSISTANT_TASK:> Python Code: %%file roots.py def quad_roots(a=1.0, b=2.0, c=0.0): Returns the roots of a quadratic equation: ax^2 + bx + c = 0. INPUTS ======= a: float, optional, default value is 1 Coefficient of quadratic term b: float, optional, default value is 2 Coefficie...
<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: Homework 5 Step2: Part 3 Step3: Part 4 Step4: Part 5 Step5: Problem 2 Step7: Problem 3 Step9: Problem 4 Step11: Problem 5 Step13: Proble...
7,417
<ASSISTANT_TASK:> Python Code: PROJECT_ID = "[<your-project-id>]" import os import sys import warnings warnings.filterwarnings('ignore') os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' # If you are running this notebook in Colab, follow the # instructions to authenticate your GCP account. This provides access to your # Cloud...
<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: Authenticate your GCP account Step2: Create a Cloud Storage bucket Step3: Only if your bucket doesn't already exist Step4: Import libraries S...
7,418
<ASSISTANT_TASK:> Python Code: # This is where the modules are imported import nltk from os import listdir from os.path import splitext from os.path import basename from tabulate import tabulate # These functions iterate through the directory and create a list of filenames def list_textfiles(directory): "Return a 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: In the next piece of code we will cycle through our directory again Step2: Here we recreate our list from the last exercise, counting the insta...
7,419
<ASSISTANT_TASK:> Python Code: # Import some stuff from __future__ import print_function, absolute_import, division import numpy as np np.random.seed(1337) # for reproducibility from keras.datasets import mnist from keras.models import Sequential from keras.layers import Dense, Dropout, Activation, Flatten 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: Neural Network Settings Step2: Get the training data Step3: Setup the model Step4: Fit the model Step5: Visualize the inputs and predictions...
7,420
<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: Examining the TensorFlow Graph Step2: Define a Keras model Step3: Download and prepare the training data. Step4: Train the model and log data...
7,421
<ASSISTANT_TASK:> Python Code: ! curl http://www.ebi.ac.uk/gxa/experiments/E-MTAB-513.tsv > E-MTAB-513.tsv ! curl http://www.ebi.ac.uk/arrayexpress/files/E-MTAB-513/E-MTAB-513.sdrf.txt> E-MTAB-513.sdrf.txt ! head E-MTAB-513.tsv ! head E-MTAB-513.sdrf.txt import pandas as pd import numpy as np import matplotlib.pyplo...
<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: What does this look like? Let's look at the top of the file with head. Step2: We'll use the pandas data analysis library to read the data. But ...
7,422
<ASSISTANT_TASK:> Python Code: %matplotlib inline import os import shutil import numpy as np import matplotlib.pyplot as plt import pandas as pd import pyemu mc = pyemu.MonteCarlo(jco="freyberg.jcb",verbose=False,forecasts=[]) mc.drop_prior_information() jco_ord = mc.jco.get(mc.pst.obs_names,mc.pst.par_names) ord_base...
<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: instaniate pyemu object and drop prior info. Then reorder the jacobian and save as binary. This is needed because the pest utilities require s...
7,423
<ASSISTANT_TASK:> Python Code: import tensorflow as tf import numpy as np import math import timeit import matplotlib.pyplot as plt %matplotlib inline from cs231n.data_utils import load_CIFAR10 def get_CIFAR10_data(num_training=49000, num_validation=1000, num_test=10000): Load the CIFAR-10 dataset from disk an...
<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: What's this TensorFlow business? Step2: Example Model Step3: TensorFlow supports many other layer types, loss functions, and optimizers - you ...
7,424
<ASSISTANT_TASK:> Python Code: from gensim.sklearn_integration import SklLdaModel from gensim.corpora import Dictionary texts = [ ['complier', 'system', 'computer'], ['eulerian', 'node', 'cycle', 'graph', 'tree', 'path'], ['graph', 'flow', 'network', 'graph'], ['loading', 'computer', 'system'], ['u...
<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 will create a dummy set of texts and convert it into a corpus Step2: Then to run the LdaModel on it Step3: Integration with Sklearn St...
7,425
<ASSISTANT_TASK:> Python Code: #importing some useful packages import matplotlib.pyplot as plt import matplotlib.image as mpimg import numpy as np import cv2 %matplotlib inline #reading in an image image = mpimg.imread('test_images/solidWhiteRight.jpg') #printing out some stats and plotting print('This image is:', type...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description: Step8: Some OpenCV functions (beyond those introduced in the lesson) that might be useful for this project are Step9: Test on Images Step10: run your...
7,426
<ASSISTANT_TASK:> Python Code: import numpy as np import pandas as pd try: # module exists import seaborn as sns seaborn_exists = True except ImportError: # module doesn't exist seaborn_exists = True import matplotlib.pyplot as plt from matplotlib.ticker import MaxNLocator %matplotlib inline # custo...
<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: Less safe zipcodes Step4: Crime monthly Step5: Weekly trends Step6: Month Days trend Step8: check zipcodes , which crime more, local buisess...
7,427
<ASSISTANT_TASK:> Python Code: from jyquickhelper import add_notebook_menu add_notebook_menu() import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sb %matplotlib inline def remove_na_rows(df, cols=None): remove row with NaN in any column if cols is None: ...
<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 libraries Step7: User-defined functions Step8: Load dataset Step9: Pre-processing data Step10: Fix missing value Step11: Standardize...
7,428
<ASSISTANT_TASK:> Python Code: from migrating_lightning import * from fastai.vision.all import * model = LitModel() data = DataLoaders(model.train_dataloader(), model.val_dataloader()).cuda() learn = Learner(data, model, loss_func=F.cross_entropy, opt_func=Adam, metrics=accuracy) learn.fit_one_cycle(1, 0.001) mnist...
<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: Using fastai's training loop Step2: To use it in fastai, we first pull the DataLoaders from the module into a DataLoaders object Step3: We can...
7,429
<ASSISTANT_TASK:> Python Code: import math import numpy as np import h5py import matplotlib.pyplot as plt import tensorflow as tf from tensorflow.python.framework import ops from tf_utils import load_dataset, random_mini_batches, convert_to_one_hot, predict %matplotlib inline np.random.seed(1) y_hat = tf.constant(36, ...
<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 that you have imported the library, we will walk you through its different applications. You will start with an example, where we compute fo...
7,430
<ASSISTANT_TASK:> Python Code: %matplotlib inline import matplotlib.pyplot as plt import numpy as np !head -n 30 open_exoplanet_catalogue.txt f=np.genfromtxt('open_exoplanet_catalogue.txt',delimiter=',') data=np.array(f) assert data.shape==(1993,24) plt.hist(data) assert True # leave for grading assert True # leave...
<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: Exoplanet properties Step2: Use np.genfromtxt with a delimiter of ',' to read the data into a NumPy array called data Step3: Make a histogram ...
7,431
<ASSISTANT_TASK:> Python Code: from __future__ import division import numpy as np import pandas as pd from scipy import stats import statsmodels.api as sm %matplotlib inline import matplotlib.pyplot as plt import seaborn as sns import warnings from itertools import product from datetime import * from dateutil.relatived...
<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: Проверка стационарности и STL-дек...
7,432
<ASSISTANT_TASK:> Python Code: #Import required packages import pandas as pd import numpy as np import datetime import matplotlib.pyplot as plt def format_date(df_date): Splits Meeting Times and Dates into datetime objects where applicable using regex. df_date['Days'] = df_date['Meeting_Times'].str.ex...
<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: OLS Analysis Using Full PSU dataset Step3: Partitioning a dataset in training and test sets Step4: Determine Feature Importances
7,433
<ASSISTANT_TASK:> Python Code: !ls /home/andi/nanopore/GenomeRU2/downloads/pass/ | tail -n 10 import porekit everything = porekit.gather_metadata("/home/andi/nanopore/", workers=4) everything[['asic_id', 'channel_number', 'template_length', 'complement_length']].head() everything.columns everything.to_hdf("everythi...
<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: These files belong to data publishd by Quick et al. http Step2: The result is a Pandas DataFrame object, which is too big to comfortably view i...
7,434
<ASSISTANT_TASK:> Python Code: import pandas as pd data = pd.read_csv('student_data.csv') data.head(5) import matplotlib.pyplot as plt import numpy as np def plot_points(data): X = np.array(data[["gre","gpa"]]) y = np.array(data["admit"]) admitted = X[np.argwhere(y==1)] rejected = X[np.argwhere(y==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: Let's plot the data and see how it looks. Step2: The data, based on only GRE and GPA scores, doesn't seem very separable. Maybe if we make a pl...
7,435
<ASSISTANT_TASK:> Python Code: print("typical output") h1 = display('initial display', display_id='some_destination') h2 = display('spoiler alert: output updated in both', display_id='some_destination') h3 = display('no output here, update above', display_id='some_destination', update=True) import os from bin...
<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: There was no simple way to make code in one cell to write output to another cell. Now there is! Step2: Ok, so far, nothing earth shattering. Bu...
7,436
<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: 오디오 데이터 준비 및 증강 Step2: 사용법 Step3: 위의 예에서 Flac 파일 brooklyn.flac는 Google Cloud에서 공개적으로 액세스할 수 있는 오디오 클립에서 가져온 것입니다. Step4: 오디오는 다음을 통해 재생할 수 있습...
7,437
<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...
7,438
<ASSISTANT_TASK:> Python Code: random.seed(1) chan = IterChannel((i, random.randint(100, 200)) for i in range(10)) print_chans(chan.tee()) from flowz.util import incremental_assembly, NO_VALUE # NO_VALUE is a special value defined for incremental_assembly() that indicates the start of assembly def prepend_assembler(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: Step2: On any given day, you may want to know not just the value on that day, but all of the historical values as well. And it would be lovely to be a...
7,439
<ASSISTANT_TASK:> Python Code: !head data/provinces.yaml !ddlgenerator -i -t postgresql data/provinces.yaml | head -20 # !ddlgenerator -i -t postgresql http://github.com/catherinedevlin/pycon2015_sqla_lightning/data/provinces.yaml !dropdb pycon !createdb pycon !ddlgenerator -i postgresql data/provinces.yaml | psql pyco...
<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: ipython_sql Step2: rdbms-subsetter
7,440
<ASSISTANT_TASK:> Python Code: # Import libraries necessary for this project import numpy as np import pandas as pd from IPython.display import display # Allows the use of display() for DataFrames # Import supplementary visualizations code visuals.py import visuals as vs # Pretty display for notebooks %matplotlib inlin...
<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 Exploration Step2: Implementation Step3: Question 1 Step4: Question 2 Step5: Question 3 Step6: Observation Step7: Implementation Step...
7,441
<ASSISTANT_TASK:> Python Code: !pip install -q amplpy ampltools MODULES=['ampl', 'gurobi'] from ampltools import cloud_platform_name, ampl_notebook from amplpy import AMPL, register_magics if cloud_platform_name() is None: ampl = AMPL() # Use local installation of AMPL else: ampl = ampl_notebook(modules=MODULE...
<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: Google Colab & Kaggle interagration Step2: Use %%ampl_eval to pass the model to AMPL Step3: Set data Step4: Use %%ampl_eval to display values...
7,442
<ASSISTANT_TASK:> Python Code: import numpy as np import matplotlib.pyplot as plt import mne from mne.datasets import sample from mne.minimum_norm import make_inverse_operator, apply_inverse data_path = sample.data_path() raw_fname = data_path + '/MEG/sample/sample_audvis_filt-0-40_raw.fif' raw = mne.io.read_raw_fif(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: Process MEG data Step2: Compute regularized noise covariance Step3: Compute the evoked response Step4: It's also a good idea to look at white...
7,443
<ASSISTANT_TASK:> Python Code: import accuread as ar import matplotlib.pyplot as plt %matplotlib inline plt.style.use(['ggplot']) moddir = '../tests/testdata/' d = ar.ReadART('demo1', # basename of simulation basefolder=moddir, # folder where the Output-folder is located scalar=True, # rea...
<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 plots Step2: Calculate transmittance and albedo
7,444
<ASSISTANT_TASK:> Python Code: import numpy as np import matplotlib.pyplot as plt import torch.nn as nn import torch.nn.functional as F import torch from torch.utils.data import Dataset from torch.utils.data import DataLoader from torchvision.transforms import Normalize from google.colab import drive import os drive.m...
<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: Our dataset Step2: Use this line to confirm the location of your files Step3: Let's set some immutable variables Step6: Next we create pytorc...
7,445
<ASSISTANT_TASK:> Python Code: # Load Biospytial modules and etc. %matplotlib inline import sys sys.path.append('/apps') sys.path.append('..') sys.path.append('../spystats') import django django.setup() import pandas as pd import matplotlib.pyplot as plt import numpy as np ## Use the ggplot style plt.style.use('ggplot'...
<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 this to automate the process. Be carefull it can overwrite current results Step2: Now we will obtain the data from the calculated empirical...
7,446
<ASSISTANT_TASK:> Python Code: def run_single_val(x, y, ahead_days, estimator): multiindex = x.index.nlevels > 1 x_y = pd.concat([x, y], axis=1) x_y_sorted = x_y.sort_index() if multiindex: x_y_train = x_y_sorted.loc[:fe.add_market_days(x_y_sorted.index.levels[0][-1], -ahead_days)] ...
<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, let's implement the rolling validation. Step2: So, I could use a training period based in an amount of market days, or in an amount of sam...
7,447
<ASSISTANT_TASK:> Python Code: import os try: import cPickle as pickle except ImportError: import pickle run_name = '2015-08-17' fname = os.path.join(run_name, 'config.pkl') with open(fname, 'rb') as f: config = pickle.load(f) try: import cPickle as pickle except ImportError: import pickle fname = ...
<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 skill_score Step2: Clusters Step3: Model and observations plots Step4: Map
7,448
<ASSISTANT_TASK:> Python Code: import numpy as np #libreria de datos numericos import matplotlib.pyplot as plt import seaborn as sns import pandas as pd import statsmodels.formula.api as smf import pylab as pl from sklearn import datasets %matplotlib inline from sklearn import datasets data = pd.read_csv('http://www-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: 2.1. Linear Regression with the Advertising database Step2: What are the features? Step3: The TV vs. Sales plot shows that, aparently, there i...
7,449
<ASSISTANT_TASK:> Python Code: # Author: Alexandre Gramfort <alexandre.gramfort@telecom-paristech.fr> # # License: BSD (3-clause) # sphinx_gallery_thumbnail_number = 3 import matplotlib.pyplot as plt import numpy as np import mne from mne.datasets import sample from mne.beamformer import make_lcmv, apply_lcmv print(__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: Get epochs Step2: Run beamformers and look at maximum outputs Step3: We can also look at the spatial distribution
7,450
<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 ...
<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: First, we must import the data from CitiBike's website. The data accessed throught the 'Get the data' link at the bottom left corner of the foll...
7,451
<ASSISTANT_TASK:> Python Code: edges = set([(1,2), (2,3), (2,4), (2,5), (4,5), (4,6), (5,6), (4,7)]) def get_vecinos(nodo): vecinos = set() #Se crea un conjunto vacio para vecinos for f,t in edges: if f == nodo: vecinos.add(t) if t == nodo: vecinos.add(f) return vecin...
<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: Ejercicio Weigthed Netwroks Step2: Imprima la matriz de adyasencia
7,452
<ASSISTANT_TASK:> Python Code: from sklearn import svm import pandas as pd import pylab as pl import seaborn as sns %matplotlib inline fit_points = [ [2,1,1], [1,2,1], [3,2,1], [4,2,0], [4,4,0], [5,1,0] ] sns.set(style="darkgrid") pl.scatter([point[0] if point[2]==1 else None for point in fit_points], ...
<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 begin by defining a set of training points. This is the set which the classifier will use to infer the data classification function. Each row...
7,453
<ASSISTANT_TASK:> Python Code: from sympy import factorint factorint(6) factorint(24480) factorint(88305875025920) from sympy import init_printing init_printing(use_latex='mathjax') from sympy import solve,N from sympy.abc import x racines = solve(x**3-3*x**2-5) racines for racine in racines: print racine.n() %...
<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: Réponse Step2: Réponse Step3: Réponse Step4: Question 3 Step5: Question 4 Step6: Réponse Step7: Question 5 Step8: Réponse Step9: Expliqu...
7,454
<ASSISTANT_TASK:> Python Code: import numpy as np import tensorflow as tf # load data with open('darksouls_training.txt', 'r') as fh: training = [sent.replace('.','').replace('\n', '').lower() for sent in fh.readlines()] # with open('darksouls_test.txt', 'r') as fh: # test = [sent.replace('.','').replace('\n',...
<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: step 1. read in the data, create word dictionary, created one-hot vectors for each word Step2: step 2. create tensorflow word2vec model
7,455
<ASSISTANT_TASK:> Python Code: # DO NOT EDIT ! from pyesdoc.ipython.model_topic import NotebookOutput # DO NOT EDIT ! DOC = NotebookOutput('cmip6', 'ncc', 'noresm2-lm', 'atmoschem') # 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...
7,456
<ASSISTANT_TASK:> Python Code: from pymicro.core.samples import SampleData as SD # CREATE dataset: the file `filename` must not exist. Verbose mode OFF data = SD(filename='my_first_dataset', verbose=False) # OPEN dataset: the file `filename` must exist. Verbose mode ON data = SD(filename='my_first_dataset', verbose=T...
<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/Open a SampleData dataset, and activate verbose mode Step2: Copy dataset and get class instance synchronized with new dataset Step3: Cr...
7,457
<ASSISTANT_TASK:> Python Code: # Addition 2+1 # Subtraction 2-1 # Multiplication 2*2 # Division 3/2 # Specifying one of the numbers as a float 3.0/2 # Works for either number 3/2.0 # We can use this float() function to cast integers as floats: float(3)/2 from __future__ import division 3/2 # Powers 2**3 # Can also ...
<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='red'>Python 3 Alert!</font> Step2: We could also "cast" the type using a function that basically turns integers into floats. This ...
7,458
<ASSISTANT_TASK:> Python Code: from pytadbit.mapping.full_mapper import full_mapping r_enz = 'HindIII' ! mkdir -p results/iterativ/$r_enz ! mkdir -p results/iterativ/$r_enz/01_mapping # for the first side of the reads full_mapping(gem_index_path='/media/storage/db/reference_genome/Homo_sapiens/hg38/hg38.gem', ...
<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 full mapping function can be used to perform either iterative or fragment-based mapping, or a combination of both. Step2: And for the secon...
7,459
<ASSISTANT_TASK:> Python Code: %pylab inline from geoscilabs.seismic.NMOwidget import ViewWiggle, InteractClean, InteractNosiy, NMOstackthree from SimPEG.utils import download # Define path to required data files synDataFilePath = 'http://github.com/geoscixyz/geosci-labs/raw/main/assets/seismic/syndata1.npy' obsDataFil...
<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 common-mid-point (CMP) gathers Step2: Step 2 Step3: Step 3 Step4: Step 4
7,460
<ASSISTANT_TASK:> Python Code: %matplotlib inline %load_ext autoreload %autoreload 2 import time import numpy as np import h5py import scipy.stats import matplotlib.pyplot as plt import seaborn as sns sns.set(style="ticks", color_codes=True, font_scale=1.5) sns.set_style({"xtick.direction": "in", "ytick.direction": "in...
<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 generation Step2: First we set a number of parameters for the run. Step3: Data analysis Step4: Trajectory analysis and assignment Step5:...
7,461
<ASSISTANT_TASK:> Python Code: import os, sys sys.path = [os.path.abspath("../../")] + sys.path from deep_learning4e import * from notebook4e import * layer = OutputLayer(size=4) example = [1,2,3,4] print(layer.forward(example)) layer = InputLayer(size=3) example = [1,2,3] print(layer.forward(example)) s = sigmoid()...
<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: Neural Network Layers Step2: The output can be treated like normalized probability when the input of output layer is calculated by probability....
7,462
<ASSISTANT_TASK:> Python Code: %matplotlib inline import matplotlib.pyplot as plt from sklearn.datasets import load_digits from sklearn.model_selection import cross_val_score, validation_curve from sklearn.tree import DecisionTreeClassifier from sklearn.ensemble import BaggingClassifier, RandomForestClassifier import n...
<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: Загрузка датасета digits с помощью функции load_digits из sklearn.datasets и подготовка матрицы признаков X и ответов на обучающей выборке y (по...
7,463
<ASSISTANT_TASK:> Python Code: from IPython.display import Image Image(url='http://xray.readthedocs.org/en/latest/_images/dataset-diagram.png', embed=True, width=950, height=300) import os import posixpath # similar to os, but less dependant on operating system import numpy as np import pandas as pd import xray N...
<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 a NetCDF file into a dataset Step2: Inspecting and selecting from dataset Step3: Now if we are only interested in soil moisture at the...
7,464
<ASSISTANT_TASK:> Python Code: from IPython.display import Image from IPython.display import HTML from IPython.display import display assert True # leave this to grade the import statements Image(url='http://images.mentalfloss.com/sites/default/files/styles/insert_main_wide_image/public/einstein1_7.jpg', embed=True, w...
<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 Step2: Use the HTML object to display HTML in the notebook that reproduces the table of Quarks on this page. This will requi...
7,465
<ASSISTANT_TASK:> Python Code: # Packages from urllib import request import os import pandas as pd # Constants used in analysis TRIP_DATA = "https://data.seattle.gov/api/views/tw7j-dfaw/rows.csv?accessType=DOWNLOAD" TRIP_FILE = "pronto_trips.csv" WEATHER_DATA = "http://uwseds.github.io/data/pronto_weather.csv" WEATHER_...
<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 challenges Step2: Colin will provide more details about function, such as variable scope, and multiple return values.
7,466
<ASSISTANT_TASK:> Python Code: import pymc3 as pm with pm.Model() as disaster_model: switchpoint = pm.DiscreteUniform('switchpoint', lower=0, upper=110) with disaster_model: early_mean = pm.Exponential('early_mean', lam=1) late_mean = pm.Exponential('late_mean', lam=1) switchpoint.distribution.defaults 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: Similarly, the rate parameters can automatically be given exponential priors Step2: PyMC includes most of the probability density functions (fo...
7,467
<ASSISTANT_TASK:> Python Code: import numpy as np arr1 = np.random.randint(10,30, size=8) arr1 arr2 = np.random.randint(20,200,size=50).reshape(5,10) #method chaining - numbers from 0 to 50 arr2 arr1[0] arr1[3] arr1[:3] #get the first 3 elements. Gets lower bounds inclusive, upper bound exclusive arr1[2:] #lower boun...
<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: Array slicing Step2: nD array slicing Step3: Array dicing Step4: Thus, you specify Step5: Array broadcasting Step6: Deep copy Step7: Noti...
7,468
<ASSISTANT_TASK:> Python Code: from polyglotdb import CorpusContext with CorpusContext('pg_tutorial') as c: q = c.query_graph(c.syllable) q = q.filter(c.syllable.stress == '1') q = q.filter(c.syllable.begin == c.syllable.word.begin) q = q.filter(c.syllable.word.end == c.syllable.word.utterance.end) ...
<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: Creating an initial query Step2: With the above, we extract information of interest about the syllable, the word it is in, the utterance it is ...
7,469
<ASSISTANT_TASK:> Python Code: # Author: Eric Larson <larson.eric.d@gmail.com> # # License: BSD (3-clause) import os.path as op import mne import numpy as np from mne import find_events, fit_dipole from mne.datasets.brainstorm import bst_phantom_elekta from mne.io import read_raw_fif print(__doc__) dipole_number = 1 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: Plot the phantom data, lowpassed to get rid of high-frequency artifacts. Step2: Now we can clean the data with OTP, lowpass, and plot. The flux...
7,470
<ASSISTANT_TASK:> Python Code: import os import sys # Google Cloud Notebook if os.path.exists("/opt/deeplearning/metadata/env_version"): USER_FLAG = "--user" else: USER_FLAG = "" ! pip3 install -U google-cloud-aiplatform $USER_FLAG ! pip3 install -U google-cloud-storage $USER_FLAG if not 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:...
7,471
<ASSISTANT_TASK:> Python Code: from symbulate import * %matplotlib inline X, Y = RV(Binomial(2, 0.5) ** 2) (X & Y).sim(10000).tabulate() ((X & Y) | (X + Y == 3)).sim(10000).tabulate() x_given_y3 = (X | (X + Y == 3)).sim(10000) x_given_y3.tabulate(normalize=True) x_given_y3.plot() X = RV(Exponential(1)) (X - 5 | (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: <a id='cond_dens_def'></a> Step2: The following simulates many $X, Y$ pairs. Note that unconditionally there are 9 possible values. Step3: Ho...
7,472
<ASSISTANT_TASK:> Python Code: import numpy as np from scipy.sparse import csr_matrix np.random.seed(10) arr = np.random.randint(4,size=(988,988)) sA = csr_matrix(arr) col = sA.getcol(0) n = col.shape[0] val = col.data for i in range(n-len(val)): val = np.append(val,0) Median, Mode = np.median(val), np.argmax(np.bi...
<SYSTEM_TASK:> Given the following text description, write Python code to implement the functionality described below step by step <END_TASK> <USER_TASK:> Description:
7,473
<ASSISTANT_TASK:> Python Code: test.info() train.describe() # train.Cabin.str.split().str.get(-1).str[0] # train.Cabin.str.split(expand=True) # train.Ticket.str.split().str.get(0).str.extract train.Ticket.str.split()[0:].str[0].head() print train[train['Survived']==1]["Age"].mean(), print train[train['Survived']==0]["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: Data Cleaning Step2: Random Forest Step3: Random Forest Results Step4: SVM Step5: mean Step6: Gradient Boosting Step7: BEST PARAMS Step8: ...
7,474
<ASSISTANT_TASK:> Python Code: %matplotlib inline import numpy as np import pylab import colour from colour.utilities.verbose import message_box name, data, illuminant = colour.COLOURCHECKERS['ColorChecker 2005'] sRGB_w = colour.sRGB_COLOURSPACE.whitepoint sRGB_XYZ_to_RGB = colour.sRGB_COLOURSPACE.XYZ_to_RGB_matrix sRG...
<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: Everything is setup and we are ready to apply some transformations but first, as a sanity check we ensure that dark skin properly converts back ...
7,475
<ASSISTANT_TASK:> Python Code: %matplotlib inline import networkx as nx import matplotlib.cm as cm import matplotlib.pyplot as plt import networkx as nx G=nx.Graph() # G = nx.DiGraph() # 有向网络 # 添加(孤立)节点 G.add_node("spam") # 添加节点和链接 G.add_edge(1,2) print(G.nodes()) print(G.edges()) # 绘制网络 nx.draw(G, with_labels = True) ...
<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: WWW Data download Step2: 描述网络 Step3: 网络直径 Step4: 密度 Step5: 作业: Step6: Spacing in Math Mode Step7: Degree centrality measures.(度中心性) Step8:...
7,476
<ASSISTANT_TASK:> Python Code: # Authors: Chris Holdgraf <choldgraf@gmail.com> # Eric Larson <larson.eric.d@gmail.com> # Nicolas Barascud <nicolas.barascud@ens.fr> # # License: BSD (3-clause) import numpy as np import matplotlib.pyplot as plt from scipy.io import loadmat from os.path import join impor...
<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 from the publication Step2: Create and fit a receptive field model Step3: Investigate model coefficients Step4: Create and fit ...
7,477
<ASSISTANT_TASK:> Python Code: data_in_shape = (2, 2, 2, 3) L = UpSampling3D(size=(2, 2, 2), data_format='channels_last') layer_0 = Input(shape=data_in_shape) layer_1 = L(layer_0) model = Model(inputs=layer_0, outputs=layer_1) # set weights to random (use seed for reproducibility) np.random.seed(260) data_in = 2 * np.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: [convolutional.UpSampling3D.1] size 2x2x2 upsampling on 2x2x2x3 input, data_format='channels_first' Step2: [convolutional.UpSampling3D.2] size ...
7,478
<ASSISTANT_TASK:> Python Code: import pandas as pd import numpy as np import hw5_answers reload(hw5_answers) from hw5_answers import * Employees = pd.read_excel('/home/data/AdventureWorks/Employees.xls') Territory = pd.read_excel('/home/data/AdventureWorks/SalesTerritory.xls') Customers = pd.read_excel('/home/data/Ad...
<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, import your solutions from hw5_answers.py. The following code looks a bit redundant. However, we do this to allow reloading the hw5_answers...
7,479
<ASSISTANT_TASK:> Python Code: import mdcs user='admin' pswd='admin' host='http://127.0.0.1:8000' template_name='DiffusionDemo' name_list=[ "GE-DiffusionCouple-IN100-IN718", "GE-DiffusionCouple-IN718-R95", "GE-DiffusionCouple-R95-R88", "GE-DiffusionCouple-R88-IN100" ] for name in name_list: xml_n...
<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: Host and user information Step2: List of file prefixes for micrograph images and XML metadata Step3: For each name in the list
7,480
<ASSISTANT_TASK:> Python Code: %matplotlib inline # plots graphs within the notebook %config InlineBackend.figure_format='svg' # not sure what this does, may be default images to svg format import matplotlib.pyplot as plt #calls the plotting library hereafter referred as to plt import numpy as np L = 8*np.pi N = 200 ...
<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 first two lines deal with the ability to show your graphs (generated via matplotlib) within this notebook, the remaining two lines import ma...
7,481
<ASSISTANT_TASK:> Python Code: import seaborn as sns import matplotlib.pyplot as plt %matplotlib inline iris = sns.load_dataset('iris') iris.head() # Just the Grid sns.PairGrid(iris) # Then you map to the grid g = sns.PairGrid(iris) g.map(plt.scatter) # Map to upper,lower, and diagonal g = sns.PairGrid(iris) g.map_dia...
<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: PairGrid Step2: pairplot Step3: Facet Grid Step4: JointGrid
7,482
<ASSISTANT_TASK:> Python Code: %matplotlib inline import collections import time import matplotlib.pyplot as plt import numpy as np import anneal from anneal.models import ClassicalIsingModel, QuantumIsingModel from anneal.annealers import SimulatedAnnealer, QuantumAnnealer POSITIONS = np.array(( (24050.0000, 1237...
<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: シミュレーティッドアニーリングの実施 Step4: 量子アニーリングの実施
7,483
<ASSISTANT_TASK:> Python Code: import os import sys import numpy import itk from itk import TubeTK as ttk from itkwidgets import view import matplotlib.pyplot as plt from matplotlib import cm %matplotlib inline ImageType=itk.Image[itk.F,2] input_image1 = "Data\ES0015_Large.mha" reader0 = itk.ImageFileReader[ImageType]...
<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 load the first input image and show it's origin, spacing, etc. Step2: Now let's split it into two overlaping images. Step3: Now let's...
7,484
<ASSISTANT_TASK:> Python Code: oxp = Symbol("Omega_x'") b = Symbol("b") n = Symbol("n") theta = Symbol("theta") s = Symbol("s") a = Symbol("a") subsampledOmega = (binomial(s, b) * binomial(n - s, a - b)) / binomial(n, a) subsampledFpF = Sum(subsampledOmega, (b, theta, s)) subsampledOmegaSlow = (binomial(s, b) * binomia...
<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 n refers to the size of the population of cells, a is the number of active cells at any instance in time, s is the number of actual synaps...
7,485
<ASSISTANT_TASK:> Python Code: import os from pyNastran.utils import print_bad_path from pyNastran.op4.op4 import read_op4 import numpy as np from numpy import float32, float64, int32, int64, product # decrease output precision np.set_printoptions(precision=3, threshold=20) help(read_op4) # read the op4, will pop ope...
<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: Print the docstring Step2: So as you can see, Nastran has many matrix formats. Step3: There are more ways to read an OP4
7,486
<ASSISTANT_TASK:> Python Code: import sys import math import ctypes import struct sys.float_info sys.int_info format(0.125, '.12g') format(0.101, '.12g') 0.3 0.1 0.1 + 0.1 + 0.1 == 0.3 f"{0x1234:b}" a = 1 "{0:b}".format(a) bin(a) sys.float_info a = 1.0 a bin(ctypes.c_uint.from_buffer(ctypes.c_float(a)).value) bin(st...
<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: Binary representation of an integer Step2: with bin() Step3: Binary representation of a float Step4: Representation errors
7,487
<ASSISTANT_TASK:> Python Code: PROJECT = 'your-gcp-project' # Replace with your project ID. import pandas as pd from google.cloud import bigquery from IPython.core.magic import register_cell_magic from IPython import get_ipython bq = bigquery.Client(project = PROJECT) # Allow you to easily have Python variables in SQL...
<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 time-series features and determine label based on market movement Step2: Label engineering Step3: TODO Step5: Add time series features...
7,488
<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 wr...
<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: Graph regularization for Twitter rumour veracity classification using natural graphs Step2: Dataset description Step4: Convert rumor annotatio...
7,489
<ASSISTANT_TASK:> Python Code: df_r1000 = df.groupby(df.index//1000).mean() fig = sns.plt.figure(figsize=(16, 6)) ax = sns.plt.subplot() df_r1000.plot(ax=ax) fig = sns.plt.figure(figsize=(16, 6)) ax = sns.plt.subplot() df_r1000[:12000].plot(ax=ax) import numpy as np import pandas as pd from scipy import signal from s...
<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: Интересные нам всплески потребления кончаются где-то на 10000-ной миллисекунде (их пять подряд, мы моргали лампочкой пять раз). Step6: Функции ...
7,490
<ASSISTANT_TASK:> Python Code: import numpy as np from sklearn.model_selection import train_test_split import pandas as pd import seaborn as sns import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D from __future__ import print_function from keras.datasets import mnist from keras.models import Sequent...
<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 и 100 итераций. Step2: Получили точность 90,96%...
7,491
<ASSISTANT_TASK:> Python Code: # import some tools to use in this example import numpy as np import matplotlib.pyplot as plt %matplotlib inline # import the model class from auxi.tools.materialphysicalproperties.idealgas import BetaT # create a model object βT = BetaT() # define the state of the gas T = 500.0 # [K] ...
<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: Demonstrations Step2: Calculating BetaT for Mutliple Temperatures Step3: Using the RhoT model Step4: Calculating RhoT for Mutliple temperatur...
7,492
<ASSISTANT_TASK:> Python Code: # Import the libraries to be used throughout. %pylab inline import matplotlib.pyplot as plt # The HTRU 2 profile data is split - one file containing the real pulsar # profiles, one file containing noise/interference profiles. We load both # these data sources here. First we construct rela...
<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 plot a single example of both classes, to show what the data looks like. First the pulsar example. Step2: It is clear that the peak is n...
7,493
<ASSISTANT_TASK:> Python Code: words = ['biracial', 'biethnic', 'bicultural', 'interracial'] plot(words) _ = plt.xlim(1890, 2015) _ = plt.ylim(10e-7, 10e-2) savefig('NYT2.png') words = ['mixed race', 'mixed ethnicity', 'other race', 'other ethnicity'] plot(words) _ = plt.ylim(2e-4, 3e-1) savefig('NYT3.png') words = [...
<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: bicultural Step2: mixed race Step3: polyculturalism has no frequency in NYT
7,494
<ASSISTANT_TASK:> Python Code: try: %load_ext autoreload %autoreload 2 %reset except: print 'NOT IPYTHON' from __future__ import division import os os.environ['MKL_NUM_THREADS'] = '1' os.environ['NUMEXPR_NUM_THREADS'] = '1' os.environ['OMP_NUM_THREADS'] = '1' import sys import glob import numpy as np 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: Step2: Generate list of data Step3: !!! NMF TEST !!! Step4: Rank Subgraphs Based on Pos/Neg Expression Step5: Plot an example of relative expression...
7,495
<ASSISTANT_TASK:> Python Code: #$HIDE_INPUT$ import matplotlib.pyplot as plt import numpy as np import pandas as pd import seaborn as sns plt.style.use("seaborn-whitegrid") plt.rc("figure", autolayout=True) plt.rc( "axes", labelweight="bold", labelsize="large", titleweight="bold", titlesize=14, ...
<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: <blockquote style="margin-right Step2: The more complicated a combination is, the more difficult it will be for a model to learn, like this for...
7,496
<ASSISTANT_TASK:> Python Code: from tecnicas_numericas import * import tecnicas_numericas print(dir(tecnicas_numericas)) def V_inf(x): return 0 def V_fin(V_0, a, x): if abs(x) < a/2: return 0 else: return V_0 control_pozo = fun_contenedor_base() agregar_control(control_pozo, FloatSlider(va...
<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: Estados ligados Step2: Para efectos numéricos el infinito se traslada a una longitud grande comparativamente al ancho del pozo, la cual se desi...
7,497
<ASSISTANT_TASK:> Python Code: import pandas as pd import numpy as np import matplotlib.pylab as plt import csv import glob from statsmodels.tsa.arima_model import ARIMA from statsmodels.tsa.arima_model import ARIMAResults import pickle #from sklearn.cross_validation import train_test_split from sklearn import linear_m...
<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: BS, buy- sell can be predicted with 85% accuracy Step3: Dataset Step4: Regression Step5: ARCH Step6: Logistic Regression Step7: Decision Tr...
7,498
<ASSISTANT_TASK:> Python Code: import pandas as pd import matplotlib.pyplot as plt import pastas as ps ps.show_versions() gw_levels = ps.read_dino(r'../data/B49F0555001_1.csv') river_levels = ps.read_dino_level_gauge(r'../data/P43H0001.csv') river_levels.metadata ax = gw_levels.plot() river_levels.plot() river_leve...
<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: For reading groundwater level timeseries there is the read_dino function. For river level gauge data there is the read_dino_level_gauge function...
7,499
<ASSISTANT_TASK:> Python Code: # Authors: Mainak Jas <mainak.jas@telecom-paristech.fr> # Eric Larson <larson.eric.d@gmail.com> # Jaakko Leppakangas <jaeilepp@student.jyu.fi> # # License: BSD (3-clause) import os.path as op import pandas as pd import numpy as np import mne from mne import combine_evoke...
<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: To reduce memory consumption and running time, some of the steps are Step2: The data was collected with a CTF 275 system at 2400 Hz and low-pas...