markdown
stringlengths
0
1.02M
code
stringlengths
0
832k
output
stringlengths
0
1.02M
license
stringlengths
3
36
path
stringlengths
6
265
repo_name
stringlengths
6
127
Select probes
%%time # Select probes by a stochastic greedy algorithms that optimizes the on-bit coverage # and minimizes the overlapping between probes. ps.select_probes_greedy_stochastic(probe_dict, N_probes_per_transcript=92, N_on_bits=4, N_threads=16) # Let's plot the probe coverage of an example transcript seq_len = len(transcr...
_____no_output_____
MIT
Library_design/CTP-10_Aire/Merfish_design_from_XJP.ipynb
shiwei23/Chromatin_Analysis_Scripts
Primer design
# Load the primer candidates into data frames forward_primers, reverse_primers = fio.load_primers(forward_primer_file, reverse_primer_file) display(forward_primers) display(reverse_primers) # Selet primers # Make an off-target from the current probe sequences. ottable_target_readout = ot.get_OTTable_for_probe_dictionar...
_____no_output_____
MIT
Library_design/CTP-10_Aire/Merfish_design_from_XJP.ipynb
shiwei23/Chromatin_Analysis_Scripts
Quality check
# Filter out probes that have off-targets to rRNA/tRNAs ot.calc_OTs(probe_dict, ottable_rtRNAs, 'target_readout_primer_sequence_t7_transcribed', 'target_readout_primer_t7_transcribed_OT_rtRNA', 15) plot.plot_hist(probe_dict, 'target_readout_primer_t7_transcribed_OT_rtRNA', y_max=400) filters.filter_probe_dict_by_metric...
_____no_output_____
MIT
Library_design/CTP-10_Aire/Merfish_design_from_XJP.ipynb
shiwei23/Chromatin_Analysis_Scripts
Get file paths
msh_file = "DW_MeshConv4nm_25nmSep.vtu" mag_file = "DW_MeshConv4nm_25nmSep.csv" # scale for the points scale = 1e9
_____no_output_____
MIT
testing/mumax_projection-Copy1.ipynb
Skoricius/xmcd-projection
Generate raytracing - skip if generated
# get the mesh, scale the points to nm msh = Mesh.from_file(msh_file, scale=scale)
_____no_output_____
MIT
testing/mumax_projection-Copy1.ipynb
Skoricius/xmcd-projection
Make sure that the projection vector is correct and that the structure is oriented well
# get the projection vector p = get_projection_vector(90, 0) # direction of xrays n = [0, 1, 1] # normal to the projection plane x0 = [-100, 0, 0] # point on the projection plane # prepare raytracing object raytr = RayTracing(msh, p, n=n, x0=x0) struct = raytr.struct struct_projected = raytr.struct_projected vis = Mes...
_____no_output_____
MIT
testing/mumax_projection-Copy1.ipynb
Skoricius/xmcd-projection
If raytracing file generated - skip if not
# load raytracing if exists raytr = np.load("raytracing.npy", allow_pickle=True).item() struct = raytr.struct struct_projected = raytr.struct_projected
_____no_output_____
MIT
testing/mumax_projection-Copy1.ipynb
Skoricius/xmcd-projection
Generate and save raytracing
raytr.get_piercings() # np.save("raytracing.npy", raytr, allow_pickle=True)
100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 56592/56592 [07:29<00:00, 125.99it/s]
MIT
testing/mumax_projection-Copy1.ipynb
Skoricius/xmcd-projection
Get the xmcd Get magnetisation, fix vertex shufflingNote: sometimes if the mesh file has multiple parts, the paraview export and the original mesh coordinates are not in the same order. I add a function to fix that when necessary
magnetisation, mag_points = load_mesh_magnetisation(mag_file, scale=scale) shuffle_file = "shuffle_indx.npy" try: shuffle_indx = np.load(shuffle_file) except FileNotFoundError: print('File not found. Generating shuffle indx') shuffle_indx = msh.get_shuffle_indx(mag_points) np.save(shuffle_file, shuffle_...
_____no_output_____
MIT
testing/mumax_projection-Copy1.ipynb
Skoricius/xmcd-projection
Get the colours and XMCD values
xmcd_value = raytr.get_xmcd(magnetisation) mag_colors = get_struct_face_mag_color(struct, magnetisation) azi=90 center_struct = [0, 0, 0] dist_struct = 1e4 center_peem = [100, -200, 0] dist_peem = 8e4 vis = MeshVisualizer(struct, struct_projected, projected_xmcd=xmcd_value, struct_colors=mag_colors) vis.show(azi=azi, ...
_____no_output_____
MIT
testing/mumax_projection-Copy1.ipynb
Skoricius/xmcd-projection
View different parts of the image separately Both
vis.update_colors(xmcd_value, mag_colors) vis.view_both(azi=azi, center=center_peem, dist=dist_peem) Image.fromarray(vis.get_image_np())
_____no_output_____
MIT
testing/mumax_projection-Copy1.ipynb
Skoricius/xmcd-projection
Projection
vis.view_projection(azi=azi, center=center_peem, dist=dist_peem) Image.fromarray(vis.get_image_np())
_____no_output_____
MIT
testing/mumax_projection-Copy1.ipynb
Skoricius/xmcd-projection
Structure
center_struct = [75, 50, 0] dist_struct = 1e4 vis.view_struct(azi=azi, center=center_struct, dist=dist_struct) Image.fromarray(vis.get_image_np())
_____no_output_____
MIT
testing/mumax_projection-Copy1.ipynb
Skoricius/xmcd-projection
Blurred image
vis.view_projection(azi=azi, center=center_peem, dist=dist_peem) Image.fromarray((vis.get_blurred_image(desired_background=0.7)*255).astype(np.uint8))
_____no_output_____
MIT
testing/mumax_projection-Copy1.ipynb
Skoricius/xmcd-projection
Saving one render
vis.view_both(azi=azi, center=center_peem, dist=dist_peem) vis.save_render('mumax_shadow.png') vis.view_projection() blurred = vis.get_blurred_image(desired_background=0.7) imsave('mumax_shadow_blurred.png', (blurred*255).astype(np.uint8), check_contrast=False) vis.view_struct(azi=azi, center=center_struct, dist=dist_...
_____no_output_____
MIT
testing/mumax_projection-Copy1.ipynb
Skoricius/xmcd-projection
The histogram looks a little fishy. The general shape of the histogram is not surprising, but the limits are. We don't even make it to $150K here, so c-suite salaries are likely excluded.
# now, a bar chart of average salary by title. helper_df = data_df.groupby(['title'])['salary'].mean() helper_df.plot.bar()
_____no_output_____
ADSL
EmployeeSQL/sql-challenge-bonus.ipynb
CraftyJack/sql-challenge
This definitely looks fishy. The average salaries are all really tightly clustered. There also doesn't seem to be much point to advancement. For example, Assistant Engineer, Engineer, and Senior Engineer all make about the same on average. With that, let's take a look behind the curtain.
punchline = pd.read_sql("SELECT * FROM employees INNER JOIN salaries ON employees.emp_no = salaries.emp_no INNER JOIN titles ON employees.emp_title = titles.title_id WHERE employees.emp_no = 499942", connection) print(punchline)
emp_no emp_title birth_date first_name last_name sex hire_date emp_no \ 0 499942 e0004 1963-01-10 April Foolsday F 1997-02-10 499942 salary title_id title 0 40000 e0004 Technique Leader
ADSL
EmployeeSQL/sql-challenge-bonus.ipynb
CraftyJack/sql-challenge
Dask Overview Dask is a flexible library for parallel computing in Python that makes scaling out your workflow smooth and simple. On the CPU, Dask uses Pandas (NumPy) to execute operations in parallel on DataFrame (array) partitions.Dask-cuDF extends Dask where necessary to allow its DataFrame partitions to be process...
from dask.distributed import Client, fire_and_forget, wait from dask_cuda import LocalCUDACluster from dask.utils import parse_bytes import dask cluster = LocalCUDACluster( CUDA_VISIBLE_DEVICES="0,1", device_memory_limit=parse_bytes("3GB"), rmm_pool_size=parse_bytes("16GB"), ) client = Client(cluster...
_____no_output_____
BSD-3-Clause
Notebooks/03-Intro_to_Dask.ipynb
quasiben/rapids-dask-tutorial-2021
Click the **Dashboard** link above to view your Dask dashboard. cuDF DataFrames to Dask DataFrames Dask lets scale our cuDF workflows. We'll walk through a couple of examples below, and then also highlight how Dask lets us spill data from GPU to CPU memory.First, we'll create a dataframe with CPU Dask and then send i...
import cudf import dask_cudf ddf = dask_cudf.from_dask_dataframe(dask.datasets.timeseries()) ddf.head()
_____no_output_____
BSD-3-Clause
Notebooks/03-Intro_to_Dask.ipynb
quasiben/rapids-dask-tutorial-2021
Example One: Groupby-Aggregations
ddf.groupby(["id", "name"]).agg({"x":['sum', 'mean']}).head()
_____no_output_____
BSD-3-Clause
Notebooks/03-Intro_to_Dask.ipynb
quasiben/rapids-dask-tutorial-2021
Run the code above again.If you look at the task stream in the dashboard, you'll notice that we're creating the data every time. That's because Dask is lazy. We need to `persist` the data if we want to cache it in memory.
ddf = ddf.persist() wait(ddf); ddf.groupby(["id", "name"]).agg({"x":['sum', 'mean']}).head()
_____no_output_____
BSD-3-Clause
Notebooks/03-Intro_to_Dask.ipynb
quasiben/rapids-dask-tutorial-2021
This is the same API as cuDF, except it works across many GPUs. Example Two: Rolling WindowsWe can also do things like rolling window calculations with Dask and GPUs.
ddf.head() rolling = ddf[['x','y']].rolling(window=3) type(rolling) rolling.mean().head()
_____no_output_____
BSD-3-Clause
Notebooks/03-Intro_to_Dask.ipynb
quasiben/rapids-dask-tutorial-2021
Larger than GPU Memory WorkflowsWhat if we needed to scale up even more, but didn't have enough GPU memory? Dask handles spilling for us, so we don't need to worry about it. The `device_memory_limit` parameter we used while creating the LocalCluster determines when we should start spilling. In this case, we'll start s...
ddf = dask_cudf.from_dask_dataframe(dask.datasets.timeseries(start="2000-01-01", end="2003-12-31", partition_freq='60d')) ddf = ddf.persist() len(ddf) print(f"{ddf.memory_usage(deep=True).sum().compute() / 1e9} GB of data") ddf.head()
_____no_output_____
BSD-3-Clause
Notebooks/03-Intro_to_Dask.ipynb
quasiben/rapids-dask-tutorial-2021
Let's imagine we have some downstream operations that require all the data from a given unique identifier in the same partition. We can repartition our data based on the `name` column using the `shuffle` API.Repartitioning our large dataframe will spike GPU memory higher than 4GB, so we'll need to spill to CPU memory.
ddf = ddf.shuffle(on="id") ddf = ddf.persist() len(ddf)
_____no_output_____
BSD-3-Clause
Notebooks/03-Intro_to_Dask.ipynb
quasiben/rapids-dask-tutorial-2021
Watch the Dask Dashboard while this runs. You should see a lot of tasks in the stream like `disk-read` and `disk-write`. Setting a `device_memory_limit` tells dask to spill to CPU memory and potentially disk (if we overwhelm CPU memory). This lets us do these large computations even when we're almost out of memory (tho...
sorted_ddf = ddf.map_partitions(lambda x: x.sort_values("id")) len(sorted_ddf)
_____no_output_____
BSD-3-Clause
Notebooks/03-Intro_to_Dask.ipynb
quasiben/rapids-dask-tutorial-2021
We could also do something more complicated and wrap it into a function. Let's do a rolling window on the two value columns after sorting by the id column.
def sort_and_rolling_mean(df): df = df.sort_values("id") df = df.rolling(3)[["x", "y"]].mean() return df result = ddf.map_partitions(sort_and_rolling_mean) result = result.persist() wait(result); # let's look at a random partition result.partitions[12].head()
_____no_output_____
BSD-3-Clause
Notebooks/03-Intro_to_Dask.ipynb
quasiben/rapids-dask-tutorial-2021
Pretty cool. When we're using `map_partitions`, the function is executing on the individual cuDF DataFrames that make up our Dask DataFrame. This means we can do any cuDF operation, run CuPy array manipulations, or anything else we want. Dask DelayedDask also provides a `delayed` API, which is useful for parallelizing...
from cuml.linear_model import LinearRegression from dask import delayed import dask import numpy as np from itertools import combinations # Setup data np.random.seed(12) nrows = 1000000 ncols = 50 df = cudf.DataFrame({f"x{i}": np.random.randn(nrows) for i in range(ncols)}) df['y'] = np.random.randn(nrows) feature_comb...
_____no_output_____
BSD-3-Clause
Notebooks/03-Intro_to_Dask.ipynb
quasiben/rapids-dask-tutorial-2021
Handling Parquet FilesDask and cuDF provide accelerated Parquet readers and writers, and it's useful to take advantage of these tools.To start, let's write out our DataFrame `ddf` to Parquet files using the `to_parquet` API and delete it from memory.
print(ddf.npartitions) ddf.to_parquet("ddf.parquet") del ddf
_____no_output_____
BSD-3-Clause
Notebooks/03-Intro_to_Dask.ipynb
quasiben/rapids-dask-tutorial-2021
Let's take a look at what happened.
!ls ddf.parquet | head
_____no_output_____
BSD-3-Clause
Notebooks/03-Intro_to_Dask.ipynb
quasiben/rapids-dask-tutorial-2021
We end up with many parquet files, and one metadata file. Dask will write one file per partition.Let's read the data back in with `dask_cudf.read_parquet`.
ddf = dask_cudf.read_parquet("ddf.parquet/") ddf
_____no_output_____
BSD-3-Clause
Notebooks/03-Intro_to_Dask.ipynb
quasiben/rapids-dask-tutorial-2021
Why do we have more partitions than files? It turns out, Dask's readers do things like chunk our data by default. Additionally, the `_metadata` file helps provide guidelines for reading the data. But, we can still read them on a per-file basis if want by using a `*` wildcard in the filepath and ignoring the metadata.
ddf = dask_cudf.read_parquet("ddf.parquet/*.parquet") ddf
_____no_output_____
BSD-3-Clause
Notebooks/03-Intro_to_Dask.ipynb
quasiben/rapids-dask-tutorial-2021
Let's now write one big parquet file and then read it back in. We can `repartition` our dataset down to a single partition.
ddf.repartition(npartitions=1).to_parquet("big_ddf.parquet") dask_cudf.read_parquet("big_ddf.parquet/")
_____no_output_____
BSD-3-Clause
Notebooks/03-Intro_to_Dask.ipynb
quasiben/rapids-dask-tutorial-2021
We still get lots of partitions? We can control the splitting behavior using the `split_row_groups` parameter.
dask_cudf.read_parquet("big_ddf.parquet/", split_row_groups=False)
_____no_output_____
BSD-3-Clause
Notebooks/03-Intro_to_Dask.ipynb
quasiben/rapids-dask-tutorial-2021
View source on GitHub Notebook Viewer Run in Google Colab Install Earth Engine API and geemapInstall the [Earth Engine Python API](https://developers.google.com/earth-engine/python_install) and [geemap](https://geemap.org). The **geemap** Python package is built upon the [ipyleaflet](https://github.com/jup...
# Installs geemap package import subprocess try: import geemap except ImportError: print('Installing geemap ...') subprocess.check_call(["python", '-m', 'pip', 'install', 'geemap']) import ee import geemap
_____no_output_____
MIT
FeatureCollection/distance.ipynb
OIEIEIO/earthengine-py-notebooks
Create an interactive map The default basemap is `Google Maps`. [Additional basemaps](https://github.com/giswqs/geemap/blob/master/geemap/basemaps.py) can be added using the `Map.add_basemap()` function.
Map = geemap.Map(center=[40,-100], zoom=4) Map
_____no_output_____
MIT
FeatureCollection/distance.ipynb
OIEIEIO/earthengine-py-notebooks
Add Earth Engine Python script
# Add Earth Engine dataset # Collection.distance example. # Computes the distance to the nearest feature in a collection. # Construct a FeatureCollection from a list of geometries. fc = ee.FeatureCollection([ ee.Geometry.Point(-72.94411, 41.32902), ee.Geometry.Point(-72.94411, 41.33402), ee.Geometry.Point(-72.94...
_____no_output_____
MIT
FeatureCollection/distance.ipynb
OIEIEIO/earthengine-py-notebooks
Display Earth Engine data layers
Map.addLayerControl() # This line is not needed for ipyleaflet-based Map. Map
_____no_output_____
MIT
FeatureCollection/distance.ipynb
OIEIEIO/earthengine-py-notebooks
Hypothesis: Are digitised practices causing more failures? HypothesisWe believe that practices undergoing Lloyd Gerge digitisation have an increased failure rate. We will know this to be true when we look at their data for the last three months, and see that either their failures have increased, or that in general the...
import pandas as pd import numpy as np import paths from data.practice_metadata import read_asid_metadata asid_lookup=read_asid_metadata("prm-gp2gp-ods-metadata-preprod", "v2/2021/8/organisationMetadata.json") transfer_file_location = "s3://prm-gp2gp-transfer-data-preprod/v4/" transfer_files = [ "2021/5/transfers...
_____no_output_____
Apache-2.0
notebooks/66-PRMT-2332--lloyd-george-digitisation-ccgs-failure-rates.ipynb
nhsconnect/prm-gp2gp-data-sandbox
Generate national transfer outcomes
national_metrics_monthly=generate_monthly_outcome_breakdown(transfers, ["month"]) national_metrics_monthly
_____no_output_____
Apache-2.0
notebooks/66-PRMT-2332--lloyd-george-digitisation-ccgs-failure-rates.ipynb
nhsconnect/prm-gp2gp-data-sandbox
Generate digitised CCG transfer outcomes
ccgs_to_investigate = [ "NHS SUNDERLAND CCG", 'NHS FYLDE AND WYRE CCG', 'NHS CHORLEY AND SOUTH RIBBLE CCG', 'NHS BLACKPOOL CCG', 'NHS BIRMINGHAM AND SOLIHULL CCG' ] is_requesting_ccg_of_interest = transfers.requesting_ccg_name.isin(ccgs_to_investigate) is_sending_ccg_of_interest = transfers.sending_...
_____no_output_____
Apache-2.0
notebooks/66-PRMT-2332--lloyd-george-digitisation-ccgs-failure-rates.ipynb
nhsconnect/prm-gp2gp-data-sandbox
Requesting CCGs (Digitised)
requesting_ccgs_monthly=generate_monthly_outcome_breakdown( transfers=requesting_transfers_of_interest, columns=["requesting_ccg_name", "month"] ) requesting_ccgs_monthly
_____no_output_____
Apache-2.0
notebooks/66-PRMT-2332--lloyd-george-digitisation-ccgs-failure-rates.ipynb
nhsconnect/prm-gp2gp-data-sandbox
Sending CCGs (Digitised)
sending_ccgs_monthly=generate_monthly_outcome_breakdown( transfers=sending_transfers_of_interest, columns=["sending_ccg_name", "month"] ) sending_ccgs_monthly
_____no_output_____
Apache-2.0
notebooks/66-PRMT-2332--lloyd-george-digitisation-ccgs-failure-rates.ipynb
nhsconnect/prm-gp2gp-data-sandbox
Requesting practices (digitised)
requesting_practices_monthly=generate_monthly_outcome_breakdown( transfers=requesting_transfers_of_interest, columns=["requesting_ccg_name", "requesting_practice_name", "requesting_practice_ods_code", "requesting_supplier", "month"] ) requesting_practices_monthly
_____no_output_____
Apache-2.0
notebooks/66-PRMT-2332--lloyd-george-digitisation-ccgs-failure-rates.ipynb
nhsconnect/prm-gp2gp-data-sandbox
Sending practices (digitised)
sending_practices_monthly=generate_monthly_outcome_breakdown( transfers=sending_transfers_of_interest, columns=["sending_ccg_name", "sending_practice_name", "sending_practice_ods_code", "sending_supplier", "month"] ) sending_practices_monthly
_____no_output_____
Apache-2.0
notebooks/66-PRMT-2332--lloyd-george-digitisation-ccgs-failure-rates.ipynb
nhsconnect/prm-gp2gp-data-sandbox
Looking at failure rate trends by CCG when requesting a record
barplot_config = { 'color': ['lightsteelblue', 'cornflowerblue', 'royalblue'], 'edgecolor':'black', 'kind':'bar', 'figsize': (15,6), 'rot': 30 } def requesting_ccg_barplot(column_name, title): ( pd .concat({'All CCGs': national_metrics_monthly}, names=['requesting_ccg_name'])...
_____no_output_____
Apache-2.0
notebooks/66-PRMT-2332--lloyd-george-digitisation-ccgs-failure-rates.ipynb
nhsconnect/prm-gp2gp-data-sandbox
Looking at failure rate trends by CCG when sending a record
def sending_ccg_barplot(column_name, title): ( pd .concat({'All CCGs': national_metrics_monthly}, names=['sending_ccg_name']) .append(sending_ccgs_monthly) .unstack() .plot( y=column_name, title=title, **barplot_...
_____no_output_____
Apache-2.0
notebooks/66-PRMT-2332--lloyd-george-digitisation-ccgs-failure-rates.ipynb
nhsconnect/prm-gp2gp-data-sandbox
Write CCG transfer outcomes by sending and requesting practice to Excel
with pd.ExcelWriter('PRMT-2332-Digitisation-Failure-Rates-May-July-2021.xlsx') as writer: national_metrics_monthly.to_excel(writer, sheet_name="National Baseline") requesting_ccgs_monthly.to_excel(writer, sheet_name="Digitised CCGs (Req)") sending_ccgs_monthly.to_excel(writer, sheet_name="Digitised CCGs (Se...
_____no_output_____
Apache-2.0
notebooks/66-PRMT-2332--lloyd-george-digitisation-ccgs-failure-rates.ipynb
nhsconnect/prm-gp2gp-data-sandbox
Data Collection Using Web Scraping To solve this problem we will need the following data :● List of neighborhoods in Pune.● Latitude and Longitudinal coordinates of those neighborhoods.● Venue data for each neighborhood. Sources● For the list of neighborhoods, I used(https://en.wikipedia.org/wiki/Category:Neighbourho...
import numpy as np # library to handle data in a vectorized manner import pandas as pd # library for data analsysis pd.set_option("display.max_columns", None) pd.set_option("display.max_rows", None) import json # library to handle JSON files from geopy.geocoders import Nominatim # convert an address into latitude a...
_____no_output_____
FTL
Developement/Data_Collection_Web_scraping.ipynb
Vivek1258/IBM-data-science-capstone
Collecting the nebourhood data using Requests, BeautifulSoup, and Geocoder labries
data = requests.get("https://en.wikipedia.org/wiki/Category:Neighbourhoods_in_Pune").text # parse data from the html into a beautifulsoup object soup = BeautifulSoup(data, 'html.parser') # create a list to store neighborhood data neighborhood_List = [] # append the data into the list for row in soup.find_all("div", cl...
_____no_output_____
FTL
Developement/Data_Collection_Web_scraping.ipynb
Vivek1258/IBM-data-science-capstone
Collecting the nebourhood venue data using Foursquare API
# define Foursquare Credentials and Version CLIENT_ID = '5HUDVH14DMECWUAFI2MICONBTTDPW1CCL1C4TFGE3FEHEUHJ' # your Foursquare ID CLIENT_SECRET = 'R0WIH5UIW2SADKBUW4B4WMY2QWBBT0Q02IURAXQXVJZMTDIV' # your Foursquare Secret VERSION = '20180605' # Foursquare API version print('Your credentails:') print('CLIENT_ID: ' + CLI...
_____no_output_____
FTL
Developement/Data_Collection_Web_scraping.ipynb
Vivek1258/IBM-data-science-capstone
Monte Carlo SimulationThis notebook provides introduction to Monte Carlo simulation using a toy example. The example is built upon a famous casino game known as **Rouulette** (Ruletka). During the game, players (bettros) make a bet on an integer, colour or a range and win if they bet was correct. Roulettes usually hav...
import random # to generate random inetegers import matplotlib.pyplot as plt # to plot simulation import seaborn as sns # to plot distribution plt.rc('figure', figsize=(20.0, 10.0)) # make the default plots bigger # the random spinner def spinner(): slot = random.randint(1,37) if slot == 0: return "lost...
/usr/local/lib/python3.6/dist-packages/matplotlib/cbook/deprecation.py:106: MatplotlibDeprecationWarning: Adding an axes using the same arguments as a previous axes currently reuses the earlier instance. In a future version, a new instance will always be created and returned. Meanwhile, this warning can be suppressed...
Apache-2.0
Monte_Carlo.ipynb
HrantDavtyan/BA_BA
Grid Search with Cross Validation
# import libraries import pandas as pd # data doesn't have headers, so let's create headers _headers = ['buying', 'maint', 'doors', 'persons', 'lug_boot', 'safety', 'car'] # read in cars dataset df = pd.read_csv('https://raw.githubusercontent.com/PacktWorkshops/The-Data-Science-Workshop/master/Chapter07/Dataset/car.dat...
_____no_output_____
MIT
Chapter07/Exercise7.07/Exercise7.07.ipynb
khieunguyen/The-Data-Science-Workshop
Tabulate results
import os import sys from typing import Tuple import pandas as pd from tabulate import tabulate from tqdm import tqdm sys.path.append('../src') from read_log_file import read_log_file LOG_HOME_DIR = os.path.join('../logs_v1/') assert os.path.isdir(LOG_HOME_DIR) MODEL_NAMES = ['logistic_regression', 'transformer_encoder...
100%|β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 6/6 [00:19<00:00, 3.30s/it]
MIT
notebooks/tabulate_results_v1.ipynb
subhadarship/nlp4if-2021
en-bg
highlight_best_score(best_results_dfs_dict['enbg']) print(tabulate_markdown(best_results_dfs_dict['enbg'])) best_hparams_dfs_dict['enbg']
_____no_output_____
MIT
notebooks/tabulate_results_v1.ipynb
subhadarship/nlp4if-2021
en-ar
highlight_best_score(best_results_dfs_dict['enar']) print(tabulate_markdown(best_results_dfs_dict['enar'])) best_hparams_dfs_dict['enar']
_____no_output_____
MIT
notebooks/tabulate_results_v1.ipynb
subhadarship/nlp4if-2021
bg-en
highlight_best_score(best_results_dfs_dict['bgen']) print(tabulate_markdown(best_results_dfs_dict['bgen'])) best_hparams_dfs_dict['bgen']
_____no_output_____
MIT
notebooks/tabulate_results_v1.ipynb
subhadarship/nlp4if-2021
bg-ar
highlight_best_score(best_results_dfs_dict['bgar']) print(tabulate_markdown(best_results_dfs_dict['bgar'])) best_hparams_dfs_dict['bgar']
_____no_output_____
MIT
notebooks/tabulate_results_v1.ipynb
subhadarship/nlp4if-2021
ar-en
highlight_best_score(best_results_dfs_dict['aren']) print(tabulate_markdown(best_results_dfs_dict['aren'])) best_hparams_dfs_dict['aren']
_____no_output_____
MIT
notebooks/tabulate_results_v1.ipynb
subhadarship/nlp4if-2021
ar-bg
highlight_best_score(best_results_dfs_dict['arbg']) print(tabulate_markdown(best_results_dfs_dict['arbg'])) best_hparams_dfs_dict['arbg']
_____no_output_____
MIT
notebooks/tabulate_results_v1.ipynb
subhadarship/nlp4if-2021
Preparation
# dependencies import pandas as pd import numpy as np import missingno as msno import matplotlib.pyplot as plt import re from sklearn.model_selection import train_test_split from textwrap import wrap from sklearn.preprocessing import StandardScaler import warnings warnings.filterwarnings("ignore") import math %matplo...
(23537, 140) (23537,)
Unlicense
Project4/Project4_sul_part4 (1).ipynb
wiggs555/cse7324project
Evaluation Modeling Exceptional Work
# Example adapted from https://github.com/rasbt/python-machine-learning-book/blob/master/code/ch12/ch12.ipynb # Original Author: Sebastian Raschka # This is the optional book we use in the course, excellent intuitions and straightforward programming examples # please note, however, that this code has been manipulated ...
Epoch: 200/200
Unlicense
Project4/Project4_sul_part4 (1).ipynb
wiggs555/cse7324project
!wget https://www.dropbox.com/s/l2ul3upj7dkv4ou/synthetic-data.zip !unzip -qq synthetic-data.zip !pip install torch_snippets torch_summary editdistance from torch_snippets import * from torchsummary import summary import editdistance device = 'cuda' if torch.cuda.is_available() else 'cpu' fname2label = lambda fname: st...
0%| | 0/50 [00:00<?, ?it/s]/usr/local/lib/python3.6/dist-packages/numpy/core/fromnumeric.py:3335: RuntimeWarning: Mean of empty slice. out=out, **kwargs) /usr/local/lib/python3.6/dist-packages/numpy/core/_methods.py:161: RuntimeWarning: invalid value encountered in double_scalars ret = ret.dtype.type(ret...
MIT
Chapter15/Handwriting_transcription.ipynb
arifmudi/Modern-Computer-Vision-with-PyTorch
Dependencies
import json, glob from tweet_utility_scripts import * from tweet_utility_preprocess_roberta_scripts_aux import * from transformers import TFRobertaModel, RobertaConfig from tokenizers import ByteLevelBPETokenizer from tensorflow.keras import layers from tensorflow.keras.models import Model
_____no_output_____
MIT
Model backlog/Inference/276-tweet-inference-5fold-roberta-avg-last.ipynb
dimitreOliveira/Tweet-Sentiment-Extraction
Load data
test = pd.read_csv('/kaggle/input/tweet-sentiment-extraction/test.csv') print('Test samples: %s' % len(test)) display(test.head())
Test samples: 3534
MIT
Model backlog/Inference/276-tweet-inference-5fold-roberta-avg-last.ipynb
dimitreOliveira/Tweet-Sentiment-Extraction
Model parameters
input_base_path = '/kaggle/input/276-tweet-train-5fold-roberta-avg-last4-onecy-exp3/' with open(input_base_path + 'config.json') as json_file: config = json.load(json_file) config vocab_path = input_base_path + 'vocab.json' merges_path = input_base_path + 'merges.txt' base_path = '/kaggle/input/qa-transformers/rob...
Models to predict: /kaggle/input/276-tweet-train-5fold-roberta-avg-last4-onecy-exp3/model_fold_1.h5 /kaggle/input/276-tweet-train-5fold-roberta-avg-last4-onecy-exp3/model_fold_2.h5 /kaggle/input/276-tweet-train-5fold-roberta-avg-last4-onecy-exp3/model_fold_3.h5 /kaggle/input/276-tweet-train-5fold-roberta-avg-last4-onec...
MIT
Model backlog/Inference/276-tweet-inference-5fold-roberta-avg-last.ipynb
dimitreOliveira/Tweet-Sentiment-Extraction
Tokenizer
tokenizer = ByteLevelBPETokenizer(vocab_file=vocab_path, merges_file=merges_path, lowercase=True, add_prefix_space=True)
_____no_output_____
MIT
Model backlog/Inference/276-tweet-inference-5fold-roberta-avg-last.ipynb
dimitreOliveira/Tweet-Sentiment-Extraction
Pre process
test['text'].fillna('', inplace=True) test['text'] = test['text'].apply(lambda x: x.lower()) test['text'] = test['text'].apply(lambda x: x.strip()) x_test, x_test_aux, x_test_aux_2 = get_data_test(test, tokenizer, config['MAX_LEN'], preprocess_fn=preprocess_roberta_test)
_____no_output_____
MIT
Model backlog/Inference/276-tweet-inference-5fold-roberta-avg-last.ipynb
dimitreOliveira/Tweet-Sentiment-Extraction
Model
module_config = RobertaConfig.from_pretrained(config['config_path'], output_hidden_states=True) def model_fn(MAX_LEN): input_ids = layers.Input(shape=(MAX_LEN,), dtype=tf.int32, name='input_ids') attention_mask = layers.Input(shape=(MAX_LEN,), dtype=tf.int32, name='attention_mask') base_model = TFRobe...
_____no_output_____
MIT
Model backlog/Inference/276-tweet-inference-5fold-roberta-avg-last.ipynb
dimitreOliveira/Tweet-Sentiment-Extraction
Make predictions
NUM_TEST_IMAGES = len(test) test_start_preds = np.zeros((NUM_TEST_IMAGES, config['MAX_LEN'])) test_end_preds = np.zeros((NUM_TEST_IMAGES, config['MAX_LEN'])) for model_path in model_path_list: print(model_path) model = model_fn(config['MAX_LEN']) model.load_weights(model_path) test_preds = model.p...
/kaggle/input/276-tweet-train-5fold-roberta-avg-last4-onecy-exp3/model_fold_1.h5 /kaggle/input/276-tweet-train-5fold-roberta-avg-last4-onecy-exp3/model_fold_2.h5 /kaggle/input/276-tweet-train-5fold-roberta-avg-last4-onecy-exp3/model_fold_3.h5 /kaggle/input/276-tweet-train-5fold-roberta-avg-last4-onecy-exp3/model_fold_4...
MIT
Model backlog/Inference/276-tweet-inference-5fold-roberta-avg-last.ipynb
dimitreOliveira/Tweet-Sentiment-Extraction
Post process
test['start'] = test_start_preds.argmax(axis=-1) test['end'] = test_end_preds.argmax(axis=-1) test['selected_text'] = test.apply(lambda x: decode(x['start'], x['end'], x['text'], config['question_size'], tokenizer), axis=1) # Post-process test["selected_text"] = test.apply(lambda x: ' '.join([word for word in x['sele...
_____no_output_____
MIT
Model backlog/Inference/276-tweet-inference-5fold-roberta-avg-last.ipynb
dimitreOliveira/Tweet-Sentiment-Extraction
Visualize predictions
test['text_len'] = test['text'].apply(lambda x : len(x)) test['label_len'] = test['selected_text'].apply(lambda x : len(x)) test['text_wordCnt'] = test['text'].apply(lambda x : len(x.split(' '))) test['label_wordCnt'] = test['selected_text'].apply(lambda x : len(x.split(' '))) test['text_tokenCnt'] = test['text'].apply...
_____no_output_____
MIT
Model backlog/Inference/276-tweet-inference-5fold-roberta-avg-last.ipynb
dimitreOliveira/Tweet-Sentiment-Extraction
Test set predictions
submission = pd.read_csv('/kaggle/input/tweet-sentiment-extraction/sample_submission.csv') submission['selected_text'] = test['selected_text'] submission.to_csv('submission.csv', index=False) submission.head(10)
_____no_output_____
MIT
Model backlog/Inference/276-tweet-inference-5fold-roberta-avg-last.ipynb
dimitreOliveira/Tweet-Sentiment-Extraction
Importing Modules
#%matplotlib notebook from tqdm import tqdm %matplotlib inline #Module to handle regular expressions import re #manage files import os #Library for emoji import emoji #Import pandas and numpy to handle data import pandas as pd import numpy as np #import libraries for accessing the database import psycopg2 from sqlalch...
_____no_output_____
MIT
Jupyter Notebook files/Analysis of Twitter.ipynb
ugis22/analysing_twitter
Preprocessing the text Before we dig into analyzing the public opinion on 'Avengers', there is an important step that we need to take: preprocessing the tweet text. But what does this mean? Text preprocessing includes a basic text cleaning following a set of simple rules commonly used but also, advanced techniques tha...
#preprocess text in tweets by removing links, @UserNames, blank spaces, etc. def preprocessing_text(table): #put everythin in lowercase table['tweet'] = table['tweet'].str.lower() #Replace rt indicating that was a retweet table['tweet'] = table['tweet'].str.replace('rt', '') #Replace occurences of m...
_____no_output_____
MIT
Jupyter Notebook files/Analysis of Twitter.ipynb
ugis22/analysing_twitter
Data Visualization After we have cleaned our data but before we start building our model for sentiment analysis, we can perform an exploratory data analysis to see what are the most frequent words that appear in our 'Avengers' tweets. For this part, we will show graphs regarding tweets labelled as positive separated f...
#Vectorization for Data Visualization def vectorization(table): #CountVectorizer will convert a collection of text documents to a matrix of token counts #Produces a sparse representation of the counts #Initialize vector = CountVectorizer() #We fit and transform the vector created frequency_matr...
_____no_output_____
MIT
Jupyter Notebook files/Analysis of Twitter.ipynb
ugis22/analysing_twitter
Preparing data for model After visualizing our data, the next step is to split our dataset into training and test sets. For doing so, we'll take advantage of the train_test_split functionality of sklearn package. We will take 20% of the dataset for testing following the 20–80% rule. From the remaining 80% used for the...
#Split Data into training and test dataset def splitting(table): X_train, X_test, y_train, y_test = train_test_split(table.tweet, table.sentiment, test_size=0.2, shuffle=True) return X_train, X_test, y_train, y_test
_____no_output_____
MIT
Jupyter Notebook files/Analysis of Twitter.ipynb
ugis22/analysing_twitter
m
#Tokenization for analysis def tokenization_tweets(dataset, features): tokenization = TfidfVectorizer(max_features=features) tokenization.fit(dataset) dataset_transformed = tokenization.transform(dataset).toarray() return dataset_transformed
_____no_output_____
MIT
Jupyter Notebook files/Analysis of Twitter.ipynb
ugis22/analysing_twitter
Train model
#Create a Neural Network #Create the model def train(X_train_mod, y_train, features, shuffle, drop, layer1, layer2, epoch, lr, epsilon, validation): model_nn = Sequential() model_nn.add(Dense(layer1, input_shape=(features,), activation='relu')) model_nn.add(Dropout(drop)) model_nn.add(Dense(layer2, acti...
_____no_output_____
MIT
Jupyter Notebook files/Analysis of Twitter.ipynb
ugis22/analysing_twitter
Test model
def test(X_test, model_nn): prediction = model_nn.predict(X_test) return prediction
_____no_output_____
MIT
Jupyter Notebook files/Analysis of Twitter.ipynb
ugis22/analysing_twitter
Main code
if __name__ == "__main__": tabletweets = "tweets_avengers" tweet_table = query_database(tabletweets) tweet_table = cleaning_table(tweet_table) if __name__ == "__main__": #First we draw a word cloud #For All tweets word_cloud(pd.Series([t for t in tweet_table.tweet]).str.cat(sep=' ')) ...
_____no_output_____
MIT
Jupyter Notebook files/Analysis of Twitter.ipynb
ugis22/analysing_twitter
Extra analysis for interaction network
if __name__ == "__main__": tweet_table_interaction = pd.read_csv("tweets_final.csv") tweet_table_interaction.rename(columns = {"text": "tweet"}, inplace=True) tweet_table_interaction = cleaning_table(tweet_table_interaction) X_interaction = tokenization_tweets(tweet_table_interaction.tweet, 3500) if __...
_____no_output_____
MIT
Jupyter Notebook files/Analysis of Twitter.ipynb
ugis22/analysing_twitter
QA Sentiment Analysis: Critical Thinking 9.2.2 Naive Bayes By JEFFREY BLACK Introduction Question: "How does increasing the sample size affect a t test? Why does it affect a t test in this manner?" Answer: "In the long run, it means that the obtained t is more likely to be significant. In terms of the formula used to...
import numpy as np import pandas as pd import os from sklearn.feature_extraction.text import TfidfVectorizer from sklearn.naive_bayes import MultinomialNB from sklearn.metrics import (f1_score,precision_score,recall_score, confusion_matrix) from sklearn.ensemble import RandomForestClassifier from sklearn.model_selectio...
_____no_output_____
MIT
NaiveBayes/NB_9_2_2_QA_Sentiment_Analysis.ipynb
jeffreyablack1/QAEvaluationNLP
*** Loading and Preprocessing the Data
CTC_9_2_2 = pd.read_excel("/Users/jeffreyblack/Desktop/NLPProject/QA_CTC.xlsx", sheet_name = 'CTC_9_2_2') CTC_9_2_2 X_train, X_test, y_train, y_test = train_test_split(CTC_9_2_2['Answers'] , CTC_9_2_2['Grade'], test_size=0.20, random_state=42)
_____no_output_____
MIT
NaiveBayes/NB_9_2_2_QA_Sentiment_Analysis.ipynb
jeffreyablack1/QAEvaluationNLP
*** Feature Extraction Convert reviews into vectors using the bag-of-words modelNote: I did not remove stop-words
def extract_features(x_train, x_test): # This function extracts document features for input documents, x # Source: # https://scikit-learn.org/stable/modules/generated/sklearn.feature_extraction.text.CountVectorizer.html#sklearn.feature_extraction.text.CountVectorizer vectorizer = TfidfVectorizer(max_f...
_____no_output_____
MIT
NaiveBayes/NB_9_2_2_QA_Sentiment_Analysis.ipynb
jeffreyablack1/QAEvaluationNLP
Calling the TF-IDF Vectorizer to extract the features for the training and test predictors.
feats_train, feats_test = extract_features(X_train, X_test) # training and test set features
['affect', 'affect the', 'affect the denominator', 'affects', 'affects the', 'affects the or', 'affects the standard', 'affects the test', 'and', 'and be', 'and be significant', 'and increase', 'and increase the', 'and the', 'and the more', 'and when', 'and when you', 'are', 'are and', 'are and when', 'as', 'as the', '...
MIT
NaiveBayes/NB_9_2_2_QA_Sentiment_Analysis.ipynb
jeffreyablack1/QAEvaluationNLP
*** Model Training: Naive Bayes Fit the training data using Multinomial Naive Bayes classifier
def build_NB_classifier(x, y): # This function builds a Multinomial Naive Bayes classifier with input (x,y): # Source: # https://scikit-learn.org/stable/modules/generated/sklearn.naive_bayes.MultinomialNB.html clf = MultinomialNB() clf.fit(x, y) return clf nb_clf = build_NB_classifier(feats_tr...
_____no_output_____
MIT
NaiveBayes/NB_9_2_2_QA_Sentiment_Analysis.ipynb
jeffreyablack1/QAEvaluationNLP
Hyperparameter TuningI decided to use Random Search Cross Validation in Scikit-Learn to determine the best hyperparameters needed for tuning the Naive Bayes classifier model. The RandomizedSearchCV allowed me to define a grid of hyperparameter randes and randomly sample from the grid, while performing K-fold cross val...
# Additive (Laplace/Lidstone) smoothing parameter (0 for no smoothing). alpha = [0, 1.0] # Whether to learn class prior probabilities or not. If false, a uniform prior will be used. fit_prior = [True, False] # Prior probabilities of the classes. If specified the priors are not adjusted according to the data. class_prio...
_____no_output_____
MIT
NaiveBayes/NB_9_2_2_QA_Sentiment_Analysis.ipynb
jeffreyablack1/QAEvaluationNLP
Using the output above, I tuned the Multinomial Naive Bayes classifier below.
def build_NB_classifier_tuned(x, y): # This function builds a Multinomial Naive Bayes classifier with input (x,y): # Source: # https://scikit-learn.org/stable/modules/generated/sklearn.naive_bayes.MultinomialNB.html clf = MultinomialNB(fit_prior = False, class_prior = None, alpha = 1.0) clf.fit(x,...
_____no_output_____
MIT
NaiveBayes/NB_9_2_2_QA_Sentiment_Analysis.ipynb
jeffreyablack1/QAEvaluationNLP
*** Model Evaluation Functions I used 3 evaluation metrics: recall, precision, and F1-score. I also used a confusion matrix to visualize false-positive, false-negative, true-positive, and true-negative.
def recall_evaluator(x, y_truth, clf): # Function to evalute model performance, using recall: # Source: # https://scikit-learn.org/stable/modules/generated/sklearn.metrics.recall_score.html#sklearn.metrics.recall_score result = 0.0 result = recall_score(y_true = y_truth, y_pred = clf.predict(x), av...
_____no_output_____
MIT
NaiveBayes/NB_9_2_2_QA_Sentiment_Analysis.ipynb
jeffreyablack1/QAEvaluationNLP
*** Summary Results of Naive Bayes Original model evaluation:
recall_nb_score = recall_evaluator(feats_test, y_test, nb_clf) precision_nb_score = precision_evaluator(feats_test, y_test, nb_clf) f1_nb_score = f1_evaluator(feats_test, y_test, nb_clf) pred_nb = nb_clf.predict(feats_test) print('Naive Bayes Recall: ', recall_nb_score) print('Naive Bayes Precision: ', precision_nb_sco...
Naive Bayes Recall: 1.0 Naive Bayes Precision: 1.0 Naive Bayes F1: 1.0 Confusion Matrix for Naive Bayes Classifier: [[4 0] [0 2]]
MIT
NaiveBayes/NB_9_2_2_QA_Sentiment_Analysis.ipynb
jeffreyablack1/QAEvaluationNLP
After hyperparameter tuning:
recall_nb_tuned_score = recall_evaluator(feats_test, y_test, nb_clf_tuned) precision_nb_tuned_score = precision_evaluator(feats_test, y_test, nb_clf_tuned) f1_nb_tuned_score = f1_evaluator(feats_test, y_test, nb_clf_tuned) pred_nb_tuned = nb_clf_tuned.predict(feats_test) print('Naive Bayes Recall: ', recall_nb_tuned_sc...
Naive Bayes Recall: 1.0 Naive Bayes Precision: 1.0 Naive Bayes F1: 1.0 Confusion Matrix for Naive Bayes Classifier: [[4 0] [0 2]]
MIT
NaiveBayes/NB_9_2_2_QA_Sentiment_Analysis.ipynb
jeffreyablack1/QAEvaluationNLP
Multivariate analysis of ferroic distortions with *atomstat* modulePrepared by Maxim ZiatdinovE-mail: maxim.ziatdinov@ai4microscopy.com In this notebook we show how the atomic coordinates derived via a pre-trained neural network from the atom-resolved image can be used to explore the extant atomic displacement patter...
!pip install atomai
Collecting atomai [?25l Downloading https://files.pythonhosted.org/packages/ec/96/052c840e2bf8a28f3efca99853ce719ab40daad5163ea08df45330bacbfc/atomai-0.6.0-py3-none-any.whl (104kB)  |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 112kB 6.0MB/s [?25hRequirement already satisfied: torch>=1.0.0 in /usr/local/lib/python3.6/d...
MIT
examples/notebooks/atomai_atomstat.ipynb
aghosh92/atomai
Import modules:
import atomai as aoi import numpy as np
_____no_output_____
MIT
examples/notebooks/atomai_atomstat.ipynb
aghosh92/atomai
Download the trained weights and test image:
download_link_model = 'https://drive.google.com/uc?id=18hXcw0tZ_fALtI2Fir1fHirAt27tRqj4' download_link_img = 'https://drive.google.com/uc?id=1peHF1lvpOKlOSMjREB2aSscyolrQQhoh' !gdown -q $download_link_model -O 'simple_model.tar' !gdown -q $download_link_img -O 'test_img.npy'
_____no_output_____
MIT
examples/notebooks/atomai_atomstat.ipynb
aghosh92/atomai
Ferroic blocks analysis with atomstat First we need to load the trained model. To do this, we specify a path to file with the trained weights and model specifics. We are going to use the weights trained in the [atomai-atomnet notebook](https://colab.research.google.com/github/ziatdinovmax/atomai/blob/master/examples/n...
# Path to file with trained weights model_dict_path = '/content/simple_model.tar' # load the weights into the model skeleton model = aoi.load_model(model_dict_path)
_____no_output_____
MIT
examples/notebooks/atomai_atomstat.ipynb
aghosh92/atomai
Make a prediction with the loaded model:
# Load experimental data expdata = np.load('test_img.npy') # Get NN output with coordinates and classes nn_output, coordinates = model.predict(expdata)
Batch 1/1 1 image was decoded in approximately 3.1576 seconds
MIT
examples/notebooks/atomai_atomstat.ipynb
aghosh92/atomai
Here we are going to use *atomstat* module to get local image descriptors first (i.e. stack of subimages around one of the atom types) and then perform different types of statistical analysis on them. This is similar to what we did in *Applied Physics Letters 115, 052902 (2019)* (although here we are going to use a dif...
imstack = aoi.stat.imlocal(nn_output, coordinates, window_size=32, coord_class=1)
_____no_output_____
MIT
examples/notebooks/atomai_atomstat.ipynb
aghosh92/atomai
Compute PCA scree plot to estimate the number of components/sources for the multivariate analysis below:
imstack.pca_scree_plot(plot_results=True);
_____no_output_____
MIT
examples/notebooks/atomai_atomstat.ipynb
aghosh92/atomai
Do PCA analysis and plot results:
pca_results = imstack.imblock_pca(4, plot_results=True)
_____no_output_____
MIT
examples/notebooks/atomai_atomstat.ipynb
aghosh92/atomai
Do ICA analysis and plot results:
ica_results = imstack.imblock_ica(4, plot_results=True)
/usr/local/lib/python3.6/dist-packages/sklearn/decomposition/_fastica.py:119: ConvergenceWarning: FastICA did not converge. Consider increasing tolerance or the maximum number of iterations. ConvergenceWarning)
MIT
examples/notebooks/atomai_atomstat.ipynb
aghosh92/atomai