Scientific Programming
153 subscribers
158 photos
30 videos
138 files
442 links
Tutorials and applications from scientific programming

https://github.com/Ziaeemehr
Download Telegram
This media is not supported in your browser
VIEW IN TELEGRAM
Generative AI course for Everyone, is now available!

Learn how Generative AI works, how to use it in professional or personal settings, and how it will affect jobs, businesses and society. This course is accessible to everyone, and assumes no prior coding or AI experience.

Please access it here.
CodiumAI vscode extension provide unittest and pytest tests automatically.
It can also provide customized test by interactive chat!
Polars is a highly performant DataFrame library for manipulating structured data. The core is written in Rust, but the library is also available in Python. Its key features are:

- Fast: Polars is written from the ground up;
- I/O: First class support for all common data storage layers: local, cloud storage & databases;
- Easy to use;
- Out of Core: Polars supports out of core data transformation with its streaming API; - Parallel;
- Vectorized Query Engine;
https://pola-rs.github.io/polars/
This media is not supported in your browser
VIEW IN TELEGRAM
NVIDIA just made Pandas 150x faster with zero code changes.

All you have to do is:
%load_ext cudf.pandas
import pandas as pd

Their RAPIDS library will automatically know if you're running on GPU or CPU and speed up your processing.

You can try it here

Credit: Lior
Why I didn't use this before?!
You can run script (also notebook) on remote server and see the results instantly, forget about repeated ssh, scp, sftp, ...

https://code.visualstudio.com/docs/remote/ssh
Understanding Deep Learning
Just took a look for now, seems 👍.
p2j - Python-to-Jupyter parser with zero intervention
The purpose of this package is to be able to run a code on Jupyter notebook without having to copy each paragraph of the code into every cell. It's also useful if we want to run our code in Google Colab. This parser isn't perfect, but you would be satisfactorily pleased with what you get.



$ pip install p2j
$ p2j script.py
$ Notebook script.ipynb written.
👍3
About 48 hours left to apply for Computational Neuroscience training program (January 22 to February 9, 2024) as a student!

Apply here by 23:59 Sunday December 17th anywhere on earth:
https://academy.neuromatch.io/pilot
اگر به یادگیری روش های درست کد نویسی pep8 علاقه دارید، سایت زیر به فارسی مطالب مفیدی دارد.

pep8.ir
Scientific Programming
Hyperparameter Tuning.pdf
GA_iris.ipynb
220.6 KB
As before we saw the process of fining the best hyperparameters for a machine learning model using gridsearch, now we consider the same example by Genetic Algorithm.

References:
0. GitHub notebook with direct link to colab.
1. Tune Your Scikit-learn Model Using Evolutionary Algorithms
2. Understanding the evaluation process
Using conda for your environments? want to just add a package for testing but not break your existing one? dislike waiting half hour for conda to make up its mind about dependencies? you can tell it to copy an existing environment without trying to download any new versions with --clone and --offline:

conda create --name copy_of_foo --clone foo --offline


credit: Marmaduke
Downloading entire playlist from YouTube using yt-dlp:


# brew install yt-dlp
yt-dlp playlisturl
use -c for continuing and -N for multi-threaded fragment downloads:

yt-dpl -c -N 5 playlisturl
ممکنه از این پلی لیست خوشتون بیاد.
2
Latexify
👍7
Pandas.pdf
2.7 MB
Pandas cheat sheet.
👍1
How to pass class of parameters to jitted python function?
Here are some examples.
It's used for writing cleaner functions which get many parameters.
COLAB
GitHub

#numba #jit
🎉1
Basic Dictionary commands (1):


# Create a dictionary
d = {'name': 'Max', 'age': 28}
d = dict(name='Anna', age=27)
squares = {x: x*x for x in range(6)}

# Reading
print(d['name'])
print(d.get('age'))
print(d.get('address')) # returns None
print(d.get('address', 'not found')) # returns 'not found'

# Adding/Modifying
d['address'] = '123 N. Elm St.'
d['name'] = 'Anna'

# Updating
d.update({'name': 'Max', 'age': 28})
d.update(address='123 N. Elm St.')
d['age'] = 30

# Deleting
del d['name']
d.pop('age')
d.popitem() # removes a random key-value pair
d.clear() # removes all items
👍1
Basic Dictionary commands (2):


# Looping
for key in d:
print(key)
for value in d.values():
print(value)
for key, value in d.items():
print(key, value)

# Copying
d_copy = d.copy()
d_copy = dict(d)

# Merging
d = {'name': 'Max', 'age': 28}
d1 = {'name': 'Anna', 'age': 27}
d.update(d1)
d = {**d, **d1}

# Dictionary Comprehension
d = {x: x**2 for x in range(10)}
d = {k: v**2 for k, v in zip(['a', 'b'], range(4))}
d = {k: v for k, v in d.items() if v % 2 == 0}
👍1