text
stringlengths
2.5k
6.39M
kind
stringclasses
3 values
# Introduction to NUMPY Numpy is a the ideal tool to work with datasets. It is much faster than using python on its own # Contents - [raw python vs numpy](#pythonvsnumpy) - [vectorisation](#vectorisation) - [create](#create) - [size](#size) - [resize](#resize) - [indexing](#indexing) - [multi axis indexing](#multiin...
github_jupyter
``` import numpy as np import matplotlib.pyplot as plt import pandas as pd import seaborn as sns import arviz as az from statsmodels.tsa import stattools import statsmodels.api as sm import pymc3 as pm import pymc import sys sys.path.insert(0, '..') from utils.plot_lib import set_default set_default(figsize=(6, 4))...
github_jupyter
# DLProfile Example using Cosmic Tagger Application ## Set imports and neccessary environment variables ``` import pathlib import os import sys import matplotlib.pyplot as plt import warnings import pprint import pandas VANIDL_DIR="{}".format(pathlib.Path(os.getcwd()).parent.parent.parent.absolute()) sys.path.insert(...
github_jupyter
##### Copyright 2019 The TensorFlow Authors. ``` #@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 ...
github_jupyter
# Project: Part of Speech Tagging with Hidden Markov Models --- ### Introduction Part of speech tagging is the process of determining the syntactic category of a word from the words in its surrounding context. It is often used to help disambiguate natural language phrases because it can be done quickly with high accu...
github_jupyter
``` import os import pandas as pd import glob import tempfile from pathlib import Path ``` #### Provide storage account parameters here ###### storage_conn_string "Storage account connection string" ###### src_container "Container where data is stored" ###### dst_container "Container where results should be uploaded"...
github_jupyter
# Topic Modeling: Financial News This notebook contains an example of LDA applied to financial news articles. ## Imports & Settings ``` import warnings warnings.filterwarnings('ignore') %matplotlib inline from collections import Counter from pathlib import Path import logging import numpy as np import pandas as pd...
github_jupyter
# Comic Book Cancellations Part I: Web Scraping While some Marvel comic books run for decades, most series go through cycles. For example, [Charles Soule's *She-Hulk* (2014)](https://www.cbr.com/charles-soule-investigates-she-hulks-blue-file/) was a colorful and quirky crime serial that got cancelled on its 12th issue...
github_jupyter
![Astrofisica Computacional](../logo.PNG) --- ## 30. Integraciรณn Numรฉrica Eduard Larraรฑaga (ealarranaga@unal.edu.co) --- ### Resumen En este cuaderno se presentan algunas tรฉcnicas de integraciรณn numรฉrica. --- Una de las tareas mรกs comunes en astrofรญsica es evaluar integrales como \begin{equation} I = \int_a^b...
github_jupyter
# Step 1 - Downloading Fitbit data via the API For this initial step, we are using [python-fitbit](https://github.com/orcasgit/python-fitbit), a Python client accessing the Fitbit API. We furthermore require an exisiting Fitbit OAuth 2.0 Client (Consumer) ID and Client (Consumer) Secret. These can be obtained by regis...
github_jupyter
##### Copyright 2020 The TensorFlow Hub Authors. Licensed under the Apache License, Version 2.0 (the "License"); ``` #@title Copyright 2020 The TensorFlow Hub Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the Lic...
github_jupyter
# Experiment 02: Study performance stability over time Study how well models trained on images from early dates perform at test time on images from later dates. This is meant to investigate how stable model performance is over time, as news rooms' image publishing pipelines (possibly) evolve. For each source, sort...
github_jupyter
``` # Prepare environment import os, sys sys.path.insert(0, os.path.abspath('..')) from IPython.display import display from IPython.core.interactiveshell import InteractiveShell InteractiveShell.ast_node_interactivity = "all" ``` ## Example starts here ------ ``` import asyncio from ibstract import IB from ibstract i...
github_jupyter
# RNN and LSTM Assignment <img src="https://upload.wikimedia.org/wikipedia/commons/thumb/3/3c/Chimpanzee_seated_at_typewriter.jpg/603px-Chimpanzee_seated_at_typewriter.jpg" width=400px> It is said that [infinite monkeys typing for an infinite amount of time](https://en.wikipedia.org/wiki/Infinite_monkey_theorem) will...
github_jupyter
Deep Learning ============= Assignment 3 ------------ Previously in `2_fullyconnected.ipynb`, you trained a logistic regression and a neural network model. The goal of this assignment is to explore regularization techniques. ``` # These are all the modules we'll be using later. Make sure you can import them # befor...
github_jupyter
# Data Science Bootcamp - The Bridge ## Precurso En este notebook vamos a ver, uno a uno, los conceptos bรกsicos de Python. Constarรกn de ejercicios prรกcticos acompaรฑados de una explicaciรณn teรณrica dada por el profesor. Los siguientes enlaces estรกn recomendados para el alumno para profundizar y reforzar conceptos a par...
github_jupyter
# Maps ## 1. Introduction Maps are a way to present information on a (roughly) spherical earth on a flat plane, like a page or a screen. Here are two examples of common map projections. The projection is only accurate in the region where the plane touches the sphere, and is less accurate as the distance between the p...
github_jupyter
# Extra Trees Classifier This Code template is for the Classification tasks using simple ExtraTreesClassifier based on the Extremely randomized trees algorithm. ### Required Packages ``` import numpy as np import pandas as pd import seaborn as se import warnings import matplotlib.pyplot as plt from sklearn.ense...
github_jupyter
# Contest rating change prediction for user using KNN algorithm. We will try to predict rating change based on previous contests - duration, authors, contest beginning hour, previous performances of the user and ratings. ## Imports ``` from database import * import numpy as np from IPython.display import display, cl...
github_jupyter
# Dynamic Content Personalization Using LinUCB This is a reference implementation of a recommendation system that dynamically learns the mapping between users and items that maximizes the conversion rates. ### Data Simulator, no external dependencies ### References 1. Li L., Chu W., Langford J., Schapire R. -- A Co...
github_jupyter
``` import time import datetime import numpy as np import pandas as pd import datatable as dt pd.set_option("display.max_columns", None, "display.max_rows", None) import tensorflow as tf from tensorflow import keras import tensorflow_addons as tfa import tensorflow_probability as tfp from tensorflow.keras import layer...
github_jupyter
``` %load_ext autoreload %autoreload 2 # For comparison import csr2d.core2 ``` # 3D CSR Potentials ``` import numpy as np import matplotlib.pyplot as plt import matplotlib %matplotlib notebook %matplotlib inline %config InlineBackend.figure_format = 'retina' #sigma_z = 40e-6 #sigma_x = 134e-6 #rho = 1538. #gamma = ...
github_jupyter
``` import baryonification as bfc from scipy.interpolate import splrep, splev from scipy.integrate import quad import matplotlib.pyplot as plt import numpy as np def cvir_fct(mvir): """ Concentrations form Dutton+Maccio (2014) c200 (200 times RHOC) Assumes PLANCK coismology """ A = 1.025 B ...
github_jupyter
# Machine Vision Applications Examples of Machine Vision Requirements * Visualize droplets ranging in size from 10 to 100 microns. * Visualize a field with 1 million drops * Classify 10 micron particles Questions * Are the particles in motion? * How much time is available to capture the image? * Do we need a CFA or...
github_jupyter
## NSE-TATAGLOBAL DATASETS ## Stock Market Prediction And Forecasting Using Stacked LSTM # LGMVIP Task-2|| Data Science ### To build the stock price prediction model, we will use the NSE TATA GLOBAL dataset. This is a dataset of Tata Beverages from Tata Global Beverages Limited, National Stock Exchange of India: Tat...
github_jupyter
# Neural Networks - Part 2 2016-09-16, Josh Montague ## The Plan - Quick review of [Part 1](https://github.com/DrSkippy/Data-Science-45min-Intros/tree/master/neural-networks-101) - The library stack (Keras, Theano, Numpy, oh my!) - Examples! - Classification (Iris) - Classification (MNIST) - Regression ...
github_jupyter
``` import matplotlib.pyplot as plt import numpy as np import os from scipy import stats import glob from scipy.stats import ks_2samp, kstest %matplotlib inline def load_summary(filename): dtype=[('minr', 'f8'), ('maxr', 'f8'), ('ca_ratio', 'f8'), ('ba_ratio', 'f8'), ('a...
github_jupyter
<img src="figures/ampel_multi.png" width="600"> ### AMPEL and the Vera Rubin Observatory The Vera Rubin Observatory, and the LSST survey, will provide a legacy collection of real-time data. Considering the potential long term impact of any transient programs, the AMPEL analysis platform was developed to host complex...
github_jupyter
# Chapter 10: RNN(Recurrent Neural Network) Application in IMDB Reviews and Sarcasm Reviews Dataset ``` import numpy as np import tensorflow as tf import matplotlib.pyplot as plt import tensorflow_datasets as tfds from tensorflow.keras.preprocessing.text import Tokenizer from tensorflow.keras.preprocessing.sequence im...
github_jupyter
``` %load_ext autoreload %autoreload 2 import datetime import os, sys import numpy as np import matplotlib.pyplot as plt import casadi as cas ##### For viewing the videos in Jupyter Notebook import io import base64 from IPython.display import HTML # from ..</src> import car_plotting # from .import src.car_plotting P...
github_jupyter
# Extensionmethods Not all operators are loaded at import of rx. ``` # Example: from_marbles import rx try: rx.Observable.from_marbles('a-b|') except Exception as ex: print 'error:', ex # shown only after ipython notebook kernel restart # -> to see whats there don't use e.g. `dir(Observable)` but find # 'def ...
github_jupyter
# CDSAPI request examples ## Python workshop, EMS2019 ### A few tips before we begin - Use CDS Web download to construct the base of your request and then build on it. - Reanalysis ERA5 data is originally stored in GRIB format and when you download it as netCDF, conversion will fail if there is more than one **Pro...
github_jupyter
## Exploration of GradientSHAP with binary MNIST **Function : Exploration of GradientSHAP with binary MNIST**<br> **Author : Team DIANNA**<br> **Contributor :**<br> **First Built : 2021.06.28**<br> **Last Update : 2021.07.06**<br> **Library : os, numpy, matplotlib, torch, captum**<b...
github_jupyter
###### Content provided under a Creative Commons Attribution license, CC-BY 4.0; code under BSD 3-Clause license. (c)2014 Lorena A. Barba, Olivier Mesnard. Thanks: NSF for support via CAREER award #1149784. # Lift on a cylinder Remember when we computed uniform flow past a [doublet](03_Lesson03_doublet.ipynb)? The st...
github_jupyter
``` import os import numpy as np data_folder = os.path.join(os.path.expanduser("~"), "Data", "websites", "textonly") documents = [open(os.path.join(data_folder, filename)).read() for filename in os.listdir(data_folder)] len(documents) pprint([document[:100] for document in documents[:5]]) from sklearn.cluster import K...
github_jupyter
``` import torch import torch.nn as nn from torch.utils.data import DataLoader import torch.optim as optim import pandas as pd import numpy as np # own Modules from models_sub_net_ls import LstmMse_LatentSpace, LstmMle_LatentSpace, AnalysisLayer from data_preperator import DataPreperatorPrediction from data_set impor...
github_jupyter
# 1. Inference on Synthetic data Author: [Marc Lelarge](https://www.di.ens.fr/~lelarge/) Date: 04/05 In this notebook, we test our approach on synthetic data. The problem can be described as follows: we are given a familly of ODEs $y'=h_\theta(y,t)$, where the function $h$ is parametrized by the parameter $\theta$ ...
github_jupyter
``` import pandas as pd, numpy as np import pyspark from pyspark.sql import SparkSession from pyspark.sql.types import * raw_data_df = pd.read_csv('IPS_payload_200000_df.csv') raw_data_df.columns import os java11_location= '/opt/homebrew/opt/openjdk@11' os.environ['JAVA_HOME'] = java11_location conf = pyspark.SparkConf...
github_jupyter
## SFC Meteorology Obs from: ** - 2017 C2 (CKITAEM-2A) ** *** - 2017 M2 (BSM-2A) *** __pyversion__==3.6 __author__==S.Bell ``` %matplotlib inline import datetime print("Last run {0}".format(datetime.datetime.now())) ``` ### connecting to erddap and retrieving and basic information ``` from erddapy import ERDD...
github_jupyter
# 04 - Full Waveform Inversion with Devito and Dask ## Introduction In this tutorial, we will build on the [previous](https://github.com/devitocodes/devito/blob/master/examples/seismic/tutorials/03_fwi.ipynb) FWI tutorial and implement parallel versions of both forward modeling and FWI objective functions. Furthermor...
github_jupyter
#Fire up graphlab create ``` import graphlab ``` #Load some house sales data Dataset is from house sales in King County, the region where the city of Seattle, WA is located. ``` sales = graphlab.SFrame('home_data.gl/') sales ``` #Exploring the data for housing sales The house price is correlated with the number o...
github_jupyter
# ART decision tree classifier attack This notebook shows how to compute adversarial examples on decision trees (as described in by Papernot et al. in https://arxiv.org/abs/1605.07277). Due to the structure of the decision tree, an adversarial example can be computed without any explicit gradients, only by traversing ...
github_jupyter
<!-- </style><figure align = "left" style="page-break-inside: avoid;"><figcaption style="font-weight: bold; font-size:16pt; font-family:inherit;" align="center"></figcaption><br> --> <img src= "images/APEX.png"> ## Introduction: What's APEX? APEX is a portfolio trade scheduler that optimizes execution with the latest...
github_jupyter
# Welcome to AI for Science Bootcamp The objective of this bootcamp is to give an introduction to application of Artificial Intelligence (AI) algorithms in Science ( High Performance Computing(HPC) Simulations ). This bootcamp will introduce participants to fundamentals of AI and how those can be applied to different ...
github_jupyter
**Chapter 1 โ€“ The Machine Learning landscape** _This is the code used to generate some of the figures in chapter 1._ # Setup First, let's make sure this notebook works well in both python 2 and 3, import a few common modules, ensure MatplotLib plots figures inline and prepare a function to save the figures: ``` # T...
github_jupyter
<h1>Table of Contents<span class="tocSkip"></span></h1> <div class="toc"><ul class="toc-item"><li><span><a href="#WaveSurfer" data-toc-modified-id="WaveSurfer-1"><span class="toc-item-num">1&nbsp;&nbsp;</span>WaveSurfer</a></span></li><li><span><a href="#Waveform_playlist" data-toc-modified-id="Waveform_playlist-2"><sp...
github_jupyter
``` #|hide #|skip ! [ -e /content ] && pip install -Uqq fastai # upgrade fastai on colab #|default_exp data.core #|export from __future__ import annotations from fastai.torch_basics import * from fastai.data.load import * #|hide from nbdev.showdoc import * ``` # Data core > Core functionality for gathering data The...
github_jupyter
If you wish to use the `enhanced_pyspark_processor`, be sure that `from sagemaker.spark.processing import PySparkProcessor` is commented out and that you're using `from enhanced_pyspark_processor import PySparkProcessor` instead. ``` import sagemaker from sagemaker.local import LocalSession #from sagemaker.spark.proce...
github_jupyter
``` import pandas as pd import numpy as np import re pd.set_option('display.max_rows', 1500) pd.set_option('display.max_columns', 42) pd.set_option('display.max_colwidth', 100) !dir upload1 = pd.read_csv('G:\datasets\Rx_Claims\Rx_BenefitPlan_20161101.csv.csv', sep='|', na_values=['nan', ' ', ' ']) upload2 = pd.read_c...
github_jupyter
# Is there a relationship between GDP per capita and PISA scores? July 2015 Written by Susan Chen at NYU Stern with help from Professor David Backus Contact: <jiachen2017@u.northwestern.edu> ##About PISA Since 2000, the Programme for International Student Assessment (PISA) has been administered every three years ...
github_jupyter
# Environment setup ``` # Connect to Google Drive from google.colab import drive drive.mount('/content/gdrive') # Copy the dataset from Google Drive to local !cp "/content/gdrive/My Drive/CBIS_DDSM.zip" . !unzip -qq CBIS_DDSM.zip !rm CBIS_DDSM.zip cbis_path = 'CBIS_DDSM' # Import libraries %tensorflow_version 1.x i...
github_jupyter
<h1 align="center">EQE512 MATRIX METHODS IN STRUCTURAL ANALYSIS <br> <br> Week 01 <br> <br> Defining the solution methods in engineering calculations using matrices and development of algorithms</h1> <h3 align="center">Dr. Ahmet Anฤฑl Dindar (adindar@gtu.edu.tr)</h3> <h4 align="center">2017 Fall </h4> ** What is "...
github_jupyter
# Gaussian Processes ## Introduction [Gaussian Processes](https://en.wikipedia.org/wiki/Gaussian_process) have been used in supervised, unsupervised, and even reinforcement learning problems and are described by an elegant mathematical theory (for an overview of the subject see [1, 4]). They are also very attractive ...
github_jupyter
``` # from google.colab import drive # drive.mount('/content/drive') # path = "/content/drive/MyDrive/Research/cods_comad_plots/sdc_task/mnist/" m = 5 desired_num = 500 import torch.nn as nn import torch.nn.functional as F import pandas as pd import numpy as np import matplotlib.pyplot as plt import torch import torc...
github_jupyter
<img src='https://assets.leetcode-cn.com/aliyun-lc-upload/uploads/2019/08/17/1336_ex1.jpeg'> <img src='https://assets.leetcode-cn.com/aliyun-lc-upload/uploads/2019/08/17/1336_ex2.jpeg'> ``` from collections import deque class Solution: def maxDistance(self, grid) -> int: N, q = len(grid), deque()...
github_jupyter
# Import statements ``` from google.colab import drive drive.mount('/content/drive') from my_ml_lib import MetricTools, PlotTools import os import numpy as np import matplotlib.pyplot as plt import pickle import pandas as pd import matplotlib.pyplot as plt from matplotlib.pyplot import figure import json import dat...
github_jupyter
# Deep Learning with Google Earth Engine, Cloud Storage and AI Platform This notebook is inspired by the following tutorials: - [Getting started: Training and prediction with Keras](https://cloud.google.com/ml-engine/docs/tensorflow/getting-started-keras) - [Down to Earth with AI Platform](https://medium.com/google-e...
github_jupyter
<b>The Relative Frequency</b> of any random variable is the number of occurance in the total number of observation. The Relative Frequency is calculated as:<br> \begin{equation} Relative Frequency = \frac{Frequency}{Total\ number\ of\ observations} \end{equation}<br> E.g. We have a samples are like { 5,7,11,19,23,5,1...
github_jupyter
# Data Wrangling with Spark SQL Quiz This quiz uses the same dataset and most of the same questions from the earlier "Quiz - Data Wrangling with Data Frames Jupyter Notebook." For this quiz, however, use Spark SQL instead of Spark Data Frames. ``` from pyspark.sql import SparkSession # TODOS: # 1) import any other ...
github_jupyter
``` from __future__ import division import pandas as pd import numpy as np from sklearn import cluster, datasets, mixture from sklearn.preprocessing import StandardScaler import matplotlib.pyplot as plt import torch import torch.nn as nn from math import pi from tqdm import tqdm from torch.distributions.multivaria...
github_jupyter
<h1 align="center">TensorFlow Neural Network Lab</h1> ์ด๋ฒˆ ์‹œ๊ฐ„์—๋Š” ํ…์„œํ”Œ๋กœ์šฐ์˜ ๊ธฐ๋ณธ์ ์ธ ๋‚ด์šฉ๋“ค์„ ์‘์šฉํ•˜์—ฌ ์•ŒํŒŒ๋ฒณ์„ ์ธ์‹ํ•˜๋Š” ๋ชจ๋ธ์„ ๋งŒ๋“ค์–ด๋ด…๋‹ˆ๋‹ค. ํ…์„œํ”Œ๋กœ์šฐ๋ฅผ ์ด์šฉํ•œ ์ฒซ ์‹ค์Šต์ด๋ผ ๋งค์šฐ ๊ธฐ๋Œ€๊ฐ€ใ… ๋ฉ๋‹ˆ๋‹ค. ์ œ๊ฐ€ ์‚ฌ์šฉํ•˜๋Š” ๋ฐ์ดํ„ฐ๋Š” <a href="http://yaroslavvb.blogspot.com/2011/09/notmnist-dataset.html">notMNIST</a> ๋ผ๊ณ ํ•˜๋Š” ๋‹ค์–‘ํ•œ ๋ชจ์–‘์˜ ์ด๋ฏธ์ง€๋กœ ๊ตฌ์„ฑ๋œ A-J ์•ŒํŒŒ๋ฒณ์ž…๋‹ˆ๋‹ค. <img src="image/notmnist.png"> ์œ„ ์ด๋ฏธ์ง€๋Š” ํ•™์Šต์‹œํ‚ฌ ์•ŒํŒŒ๋ฒณ์˜ ...
github_jupyter
## Figure3_Geographical distribution of data in United States ``` import os import pickle import time import numpy as np import pandas as pd import matplotlib as mpl import matplotlib.pyplot as plt #importing basemap import mpl_toolkits mpl_toolkits.__path__.append('C:/Users/hp/Anaconda3/pkgs/basemap-1.2.0-py37h0354...
github_jupyter
# ----------ๅฃฐๆ˜Žๅธธ้‡---------- ``` # Hongjun Wu # 20180723 # A script that recommends stock based on data and conditions given. # Import Statement from selenium import webdriver from bs4 import BeautifulSoup from decimal import Decimal from selenium.common.exceptions import ElementNotVisibleException import turicreate as...
github_jupyter
This notebook was prepared by [Donne Martin](https://github.com/donnemartin). Source and license info is on [GitHub](https://github.com/donnemartin/system-design-primer-primer). # Design a deck of cards ## Constraints and assumptions * Is this a generic deck of cards for games like poker and black jack? * Yes, d...
github_jupyter
## Universidade Federal do Rio Grande do Sul (UFRGS) Programa de Pรณs-Graduaรงรฃo em Engenharia Civil (PPGEC) # PEC00025: Introduction to Vibration Theory ### Class 14 - Vibration of beams [1. The vibrating beam equation](#section_1) [2. Free vibration solution](#section_2) [3. Vibration modes and fr...
github_jupyter
#### New to Plotly? Plotly's Python library is free and open source! [Get started](https://plotly.com/python/getting-started/) by downloading the client and [reading the primer](https://plotly.com/python/getting-started/). <br>You can set up Plotly to work in [online](https://plotly.com/python/getting-started/#initiali...
github_jupyter
# [Optional] Data Preparation --- This section is **optional**. For the purpose of making this lab as efficient as possible, data sets have already been prepared for you in MXNet [RecordIO format](https://mxnet.incubator.apache.org/versions/master/faq/recordio.html), which has various benefits including performance en...
github_jupyter
``` %matplotlib inline import matplotlib.pyplot as plt plt.style.use('ggplot') # Eventually, for Anaconda warnings. # Can be commented out. import warnings warnings.filterwarnings("ignore") %matplotlib inline %load_ext autoreload %autoreload 2 # Load basic libraries import seaborn; seaborn.set() import pickle, copy, ...
github_jupyter
``` import itertools from pathlib import Path import re import sys %matplotlib inline import matplotlib.pyplot as plt import numpy as np import pandas as pd import seaborn as sns import scipy.io from tqdm import tqdm sns.set_style("whitegrid") %load_ext autoreload %autoreload 2 sys.path.append("../src") import neare...
github_jupyter
Everything is a network. [Assortativity](http://arxiv.org/pdf/cond-mat/0205405v1.pdf) is an interesting property of networks. It is the tendency of nodes in a network to be attached to other nodes that are similar in some way. In social networks, this is sometimes called "homophily." One kind of assortativity that is ...
github_jupyter
# ้€‰ๆ‹ฉ ## ๅธƒๅฐ”็ฑปๅž‹ใ€ๆ•ฐๅ€ผๅ’Œ่กจ่พพๅผ ![](../Photo/33.png) - ๆณจๆ„๏ผšๆฏ”่พƒ่ฟ็ฎ—็ฌฆ็š„็›ธ็ญ‰ๆ˜ฏไธคไธช็ญ‰ๅท๏ผŒไธ€ไธช็ญ‰ๅˆฐไปฃ่กจ่ต‹ๅ€ผ - ๅœจPythonไธญๅฏไปฅ็”จๆ•ดๅž‹0ๆฅไปฃ่กจFalse๏ผŒๅ…ถไป–ๆ•ฐๅญ—ๆฅไปฃ่กจTrue - ๅŽ้ข่ฟ˜ไผš่ฎฒๅˆฐ is ๅœจๅˆคๆ–ญ่ฏญๅฅไธญ็š„็”จๅ‘ ``` a = id(1) b = id(1) print(a,b) # ๅ› ไธบaๅ’Œbๅนถไธๆ˜ฏๅŒไธ€ไธชๅฏน่ฑก a is b a = id(1) b = a a is b a = True b = False id(True) a == b a is b ``` ## ๅญ—็ฌฆไธฒ็š„ๆฏ”่พƒไฝฟ็”จASCIIๅ€ผ ``` a = "jokar" b = "jokar" a > b ``` ## M...
github_jupyter
# bioimageio.core usage examples ``` import os import hashlib import bioimageio.core import imageio # we use napari for visualising images, you can install it via `pip install napari` or`conda install napari` import napari import numpy as np import xarray as xr from bioimageio.core.prediction_pipeline import create_...
github_jupyter
# Diseรฑo de software para cรณmputo cientรญfico ---- ## Unidad 3: NO-SQL ### Agenda de la Unidad 3 --- #### Clase 1 - Lectura y escritura de archivos. - Persistencia de binarios en Python (pickle). - Archivos INI/CFG, CSV, JSON, XML y YAML #### Clase 2 - Bases de datos relacionales y SQL. ### Clase 3 - **Breve rep...
github_jupyter
# Getting started with Perceptual Adversarial Robustness This notebook contains examples of how to load a pretrained model, measure LPIPS distance, and construct perceptual and non-perceptual attacks. If you are running this notebook in Google Colab, it is recommended to use a GPU. You can enable GPU acceleration by ...
github_jupyter
# Self study 1 In this self study you should work on the code examples below together with the associated questions. The notebook illustrates a basic neural network implementation, where we implement most of the relevant functions from scratch. Except the calculation of gradients, for which we rely on the functionalit...
github_jupyter
#### New to Plotly? Plotly's Python library is free and open source! [Get started](https://plot.ly/python/getting-started/) by downloading the client and [reading the primer](https://plot.ly/python/getting-started/). <br>You can set up Plotly to work in [online](https://plot.ly/python/getting-started/#initialization-fo...
github_jupyter
``` text = """เคฌเฅ‡เค–เคฏเคพเคฒเฅ€ เคฎเฅ‡เค‚ เคญเฅ€ เคคเฅ‡เคฐเคพ เคนเฅ€ เค–เคฏเคพเคฒ เค†เค "เค•เฅเคฏเฅ‚เค เคฌเคฟเค›เฅœเคจเคพ เคนเฅˆ เฅ›เคฐเฅ‚เคฐเฅ€?" เคฏเฅ‡ เคธเคตเคพเคฒ เค†เค เคคเฅ‡เคฐเฅ€ เคจเฅ›เคฆเฅ€เค•เคฟเคฏเฅ‹เค‚ เค•เฅ€ เฅ™เฅเคถเฅ€ เคฌเฅ‡เคนเคฟเคธเคพเคฌ เคฅเฅ€ เคนเคฟเคธเฅเคธเฅ‡ เคฎเฅ‡เค‚ เคซเคผเคพเคธเคฒเฅ‡ เคญเฅ€ เคคเฅ‡เคฐเฅ‡ เคฌเฅ‡เคฎเคฟเคธเคพเคฒ เค†เค เคฎเฅˆเค‚ เคœเฅ‹ เคคเฅเคฎเคธเฅ‡ เคฆเฅ‚เคฐ เคนเฅ‚เค, เค•เฅเคฏเฅ‚เค เคฆเฅ‚เคฐ เคฎเฅˆเค‚ เคฐเคนเฅ‚เค? เคคเฅ‡เคฐเคพ เค—เฅเคฐเฅเคฐ เคนเฅ‚เค เค† เคคเฅ‚ เคซเคผเคพเคธเคฒเคพ เคฎเคฟเคŸเคพ, เคคเฅ‚ เค–เฅเคตเคพเคฌ เคธเคพ เคฎเคฟเคฒเคพ เค•เฅเคฏเฅ‚เค เค–เฅเคตเคพเคฌ เคคเฅ‹เฅœ เคฆเฅ‚เค? เคฌเฅ‡เค–เคฏเคพเคฒเฅ€ เคฎเฅ‡เค‚ เคญเฅ€ เคคเฅ‡เคฐเคพ เคนเฅ€ เค–เคฏเคพเคฒ เค†เค "เค•เฅเคฏเฅ‚เค เคœเฅเคฆเคพเคˆ เคฆเฅ‡ เค—เคฏเคพ เคคเฅ‚?"...
github_jupyter
# Machine Learning Models for SCOPE: Passive Aggressive Classifier Models will be coded here, but the official write up will be in the RMarkdown document. ``` # load the data files import pandas as pd import numpy as np from pymodelutils import utils logs = pd.read_csv("data/metis_logs.csv") logs.head() # filter down...
github_jupyter
# LABXX: What-if Tool: Model Interpretability Using Mortgage Data **Learning Objectives** 1. Create a What-if Tool visualization 2. What-if Tool exploration using the XGBoost Model ## Introduction This notebook shows how to use the [What-if Tool (WIT)](https://pair-code.github.io/what-if-tool/) on a deployed [...
github_jupyter
# Simulation Experiments We simulate a greybox fuzing campaign to understand the behavior of discovery probability as more inputs are generated. In contrast to a blackbox fuzzer, a greybox fuzzer adds inputs to the corpus that discover a new species (e.g., that cover a new program branch). We simulate ๐‘‡๐‘Ÿ๐‘–๐‘Ž๐‘™=30 ...
github_jupyter
# Random Forest The aim of this part of the workshop is to give you initial experience in using *random forests*, which is a popular ensemble method that was presented earlier in the lectures. A particular emphasis is given to the *out-of-bag* error (sometimes called out-of-sample error) that can be used to select ran...
github_jupyter
# ์‚ผ์„ฑ์ „์ž ์ฒจ๊ธฐ์—ฐ ์‹œ๊ฐ ์‹ฌํ™” - **Instructor**: Jongwoo Lim / Jiun Bae - **Email**: [jlim@hanyang.ac.kr](mailto:jlim@hanyang.ac.kr) / [jiun.maydev@gmail.com](mailto:jiun.maydev@gmail.com) ``` from pathlib import Path import yaml import numpy as np import pandas as pd import torch from models.mdnet import MDNet, BCELoss, Precisi...
github_jupyter
# MNIST using RNN ## ์‹œ์ž‘ํ•˜๊ธฐ * ์‚ฌ์šฉํ•  ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋ฅผ import ํ•ฉ๋‹ˆ๋‹ค. * ๋ณธ ์˜ˆ์ œ๋Š” tensorflow๋ฅผ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค. * ๋ฐ์ดํ„ฐ์…‹์€ tensorflow์—์„œ ์ œ๊ณตํ•˜๋Š” mnist ๋ฐ์ดํ„ฐ์…‹์„ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค. ``` import tensorflow as tf import numpy as np import matplotlib.pyplot as plt from tensorflow.examples.tutorials.mnist import input_data import os import time tf.reset_default_graph() %matpl...
github_jupyter
<a href="https://colab.research.google.com/github/pyGuru123/Data-Analysis-and-Visualization/blob/main/Tracking%20Bird%20Migration/bird_migration.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> One fascinating area of research uses GPS to track movem...
github_jupyter
``` # default_exp metrics ``` # metrics > API details. ``` #export #hide import numpy as np import scipy.stats import torch from scipy.stats import chi2 as Chi2Dist import matplotlib.pyplot as plt from sklearn.metrics import auc from fastcore.test import * from fastai.metrics import rmse import dcor #export def crps...
github_jupyter
# ็ตฑ่จˆ็š„ๆŽจๅฎš ``` import numpy as np import pandas as pd import matplotlib.pyplot as plt from scipy import stats %precision 3 %matplotlib inline df = pd.read_csv('../data/ch4_scores400.csv') scores = np.array(df['็‚นๆ•ฐ']) p_mean = np.mean(scores) p_var = np.var(scores) p_mean, p_var fig = plt.figure(figsize=(10, 6)) ax = fig...
github_jupyter
``` import numpy as np import pandas as pd np.seterr(divide='ignore', invalid='ignore') data = pd.io.parsers.read_csv('data/final-new-ratings.csv', names=['user_id', 'movie_id', 'rating', 'time'], engine='python', delimiter=';') movie_data = pd.io.parsers.read...
github_jupyter
# Regularization Welcome to the second assignment of this week. Deep Learning models have so much flexibility and capacity that **overfitting can be a serious problem**, if the training dataset is not big enough. Sure it does well on the training set, but the learned network **doesn't generalize to new examples** that...
github_jupyter
# Title **Class imbalance: Random Forest vs SMOTE Classification** # Description The goal of this exercise is to investigate the performance of Random Forest with and without class balancing techniques on a dataset with class imbalance. The comparison will look a little something like this: <img src="../img/image2...
github_jupyter
# API Demo: Search, Order, and Download Capella's Rotterdam Data Set Capella has collected two AOIs - 10 x 5 km each. Each AOI will be covered from 8am to 8pm over two days, 6 times each day to simulate roughly two hour revisit at very high resolution. The main features in the AOIs are: the port, ships (tankers and ...
github_jupyter
# 19 - Exploring Well Log Data using the Welly Python Library The welly library was developed by Agile Geoscience to help with loading, processing and analysing well log data from a single well or multiple wells. The library allows exploration of the meta data found within the headers of las files and also contains a ...
github_jupyter
``` import pandas as pd from bs4 import BeautifulSoup df = pd.read_csv('train.csv', sep=';') texts = df['text'] from pymystem3 import Mystem morph = Mystem() import re import nltk nltk.download('punkt') def text_to_sent(t): text = BeautifulSoup(t).text.lower() tokenizer = nltk.data.load('tokenizers/punkt/russi...
github_jupyter
``` # Copyright 2021 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 applicable law or agreed to in writi...
github_jupyter
# Exemplos --- * Vamos realizar alguns exercรญcios legais com dicionรกrios. **<font color="red"> Questรฃo 1 </font>** --- Digamos que vocรช estรก construindo um programa para identificar nรญveis de $CO_{2}$ (gรกs carbรดnico) em determinados locais para evitar potenciais acidentes. Em cada um desses locais a sua empresa tem ...
github_jupyter
# Identifying the diffusion equation from a random walk Samuel Rudy, 2016 Here we take various lengths of a random walk where $x_{j+1} \sim \mathcal{N}(x_j, dt)$ and see if we can identify the diffusion equation. As expected, it works better for longer series. ``` %pylab inline pylab.rcParams['figure.figsize'] = (1...
github_jupyter
<div class="alert alert-block alert-info" style="margin-top: 20px"> <a href="https://cocl.us/topNotebooksPython101Coursera"> <img src="https://s3-api.us-geo.objectstorage.softlayer.net/cf-courses-data/CognitiveClass/PY0101EN/Ad/TopAd.png" width="750" align="center"> </a> </div> <a href="https://cognit...
github_jupyter
## Topological Data Analysis - Part 5 - Persistent Homology This is Part 5 in a series on topological data analysis. See <a href="TDApart1.html">Part 1</a> | <a href="TDApart2.html">Part 2</a> | <a href="TDApart3.html">Part 3</a> | <a href="TDApart4.html">Part 4</a> <a href="https://github.com/outlace/OpenTDA/Persist...
github_jupyter
``` import numpy as np import json import pandas as pd import matplotlib.pyplot as plt import linear_regression as clf from learning_rate import * import model from data_process import load_data import seaborn as sns import time %matplotlib inline %load_ext autoreload %autoreload 1 ``` # Task 1 ``` with open("data/r...
github_jupyter
<a href="https://colab.research.google.com/github/john-s-butler-dit/Basic-Introduction-to-Python/blob/master/W1T3%20The%20Psychometric%20Function.ipynb" target="_parent"><img src="https://colab.research.google.com/assets/colab-badge.svg" alt="Open In Colab"/></a> # The Psychometric Function Week 1, Tutorial 3 In this...
github_jupyter
Parallel Map on Files ------------------------ For each of a set of filenames, we parse JSON data contents, load that data into a Pandas DataFrame, and then output the result to another file with a nicer format, HDF5. We find that parsing JSON is slow and so we parallelize the process using the [concurrent.futures](h...
github_jupyter