New pages

From Master of Neuroscience Wiki
New pages
Hide registered users | Hide bots | Show redirects
(newest | oldest) View ( | ) (20 | 50 | 100 | 250 | 500)

22 October 2025

  • 16:1416:14, 22 October 2025 2020: Deep Networks and Tensor Flow (hist | edit) [9,884 bytes] Davrot (talk | contribs) (Created page with "'''When in our modern world a problem is too tedious or too complicated to solve, it is always a good idea to promise an AI solution to handle the problem for us. AI, short for Artificial Intelligence, is the information age’s word for magic. In this project, we will take a deeper look into machine learning. Machine learning is typically what the people on the street mean by AI. In machine learning, sophisticated algorithms extract the underlying statistical structure...") Tag: Visual edit
  • 16:1316:13, 22 October 2025 2022: Synchronization and dynamic oscillations in the visual system (hist | edit) [4,810 bytes] Davrot (talk | contribs) (Created page with "'''Oscillatory activity is ubiquitous throughout the cortex and has been hypothesized to play a central role for brain function, for example, in realizing selective information routing under attention. Fundamental for establishing oscillatory activity are recurrently coupled neural circuits which engage in a collective dynamics when driven externally. In this mini-project, you will implement a simple network model which is capable to generate gamma-frequency oscillations...") Tag: Visual edit
  • 16:1116:11, 22 October 2025 2022: Divisive inhibition: a dynamical circuit for change detection (hist | edit) [4,417 bytes] Davrot (talk | contribs) (Created page with "'''Neural computation is highly flexible and adjusts the spatio-temporal context of external stimuli and to the current behavioral task. This flexibility is an important aspect why squishy brains are under the rapidly changing conditions in daily life still superior to machines. Divisive inhibition is a fundamental concept realizing an adaptive dynamics which has interesting functional consequences. For example, it can enhance changes in the sensory input:''' '''Think o...") Tag: Visual edit
  • 16:0616:06, 22 October 2025 2022: Deep Networks and Pytorch (hist | edit) [4,649 bytes] Davrot (talk | contribs) (Created page with "'''When in our modern world a problem is too tedious or too complicated to solve, it is always a good idea to promise an AI solution to handle the problem for us. AI, short for Artificial Intelligence, is the information age’s word for magic. In this project, we will take a deeper look into machine learning. Machine learning is typically what the people on the street mean by AI. In machine learning, sophisticated algorithms extract the underlying statistical structure...") Tag: Visual edit
  • 16:0316:03, 22 October 2025 2022: Preparation -- Python class with and without classes (hist | edit) [5,711 bytes] Davrot (talk | contribs) (Created page with "'''Programming has to be practiced, it can not be learned from looking at slides alone. Here we give you some simple tasks to implement in Python, which add up to a mini-simulation of synaptic transmission in the end. We structured this exercise such that you can start with simple tasks and add complexity with each additional concept you learn in our lectures.''' == Task 0. Get ready to create Python programs == === a. === [https://davrot.github.io/pytutorial/workflow/...") Tag: Visual edit
  • 15:3215:32, 22 October 2025 Symbolic Computation (hist | edit) [10,554 bytes] Davrot (talk | contribs) (Created page with "Questions to [mailto:davrot@uni-bremen.de David Rotermund]<syntaxhighlight lang="shell">pip install sympy</syntaxhighlight> === Overview tutorials === {| class="wikitable" |[https://docs.sympy.org/latest/tutorials/intro-tutorial/basic_operations.html Basic Operations] |- |[https://docs.sympy.org/latest/tutorials/intro-tutorial/printing.html Printing] |- |[https://docs.sympy.org/latest/tutorials/intro-tutorial/simplification.html Simplification] |- |[https://docs.sympy.o...") Tag: Visual edit

21 October 2025

  • 16:0816:08, 21 October 2025 Tensorflow / Keras A fast non-introduction (hist | edit) [29,267 bytes] Davrot (talk | contribs) (Created page with " = Tensorflow / Keras – A fast non-introduction = {:.no_toc} <nav class="toc-class"> * TOC {:toc} </nav> == Top == This is a fast overview how to get an MNIST example running under TF Keras If you just want to start with Tensorflow / Keras (especially if it is a scientific project), then you want to reconsider using Keras. In this case please check (& use) PyTorch. Questions to [mailto:davrot@uni-bremen.de David Rotermund] == Data loader / Data generator =...") Tag: Visual edit originally created as "A fast non-introduction"
  • 16:0616:06, 21 October 2025 The fast and furious way (CPU and GPU CUDA) (hist | edit) [9,775 bytes] Davrot (talk | contribs) (Created page with "Let us assume that you know what you are doing. And also let us assume that you notices how extremely slow the “correct” way of communication between Python and C++ is. Well the following section is for you… Questions to [mailto:davrot@uni-bremen.de David Rotermund] == Design corner stone == It is the job of Python (Numpy or PyTorch) to provide the tensors from which we read and in which we write. In the cpp domain, we will use this matrices as the interface to P...") Tag: Visual edit
  • 16:0516:05, 21 October 2025 PyBind11 Stub-Generation (hist | edit) [11,675 bytes] Davrot (talk | contribs) (Created page with "Questions to [mailto:davrot@uni-bremen.de David Rotermund] == ModuleStubsGenerator == If you editor / syntax highlighting complains then you might need module stubs. This is the way how I automatically generate my pybind11-stubs<syntaxhighlight lang="shell">pip install pybind11-stubgen</syntaxhighlight><syntaxhighlight lang="python"># Based on # https://github.com/sizmailov/pybind11-stubgen/blob/master/pybind11_stubgen/__init__.py from __future__ import annotations im...") Tag: Visual edit
  • 15:0815:08, 21 October 2025 Expanding Python with C++ modules (hist | edit) [34,629 bytes] Davrot (talk | contribs) (Created page with "A minimal introduction in how to use PyBind11. PyBind11 allows you to extend Python with C++ modules which are written in C++11 or newer. Questions to [mailto:davrot@uni-bremen.de David Rotermund] == A very simple example == What do we need in the most minimal scenario? * Makefile plus a .env file * Module wrapper (PyMyModuleCPU.cpp) * The module (MyModuleCPU.cpp and MyModuleCPU.h) * Some test code test.py == Makefile == If you are programming...") Tag: Visual edit
  • 14:5814:58, 21 October 2025 Fisher Exact Test: Test if your performance difference is significant (hist | edit) [6,056 bytes] Davrot (talk | contribs) (Created page with "Questions to [mailto:davrot@uni-bremen.de David Rotermund] == [https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.fisher_exact.html scipy.stats.fisher_exact] == <syntaxhighlight lang="python">scipy.stats.fisher_exact(table, alternative='two-sided')</syntaxhighlight><blockquote>Perform a Fisher exact test on a 2x2 contingency table. The null hypothesis is that the true odds ratio of the populations underlying the observations is one, and the observations w...") Tag: Visual edit
  • 14:5514:55, 21 October 2025 How to take advantage of a learning rate scheduler for your non-Pytorch project (hist | edit) [1,972 bytes] Davrot (talk | contribs) (Created page with "Pytorch provides you with so called lr_scheduler (learning rate scheduler). Their job is to control the learning rate according the development of the loss during learning. How can we use it for our own stimulation, without using the rest of PyTorch? Questions to [mailto:davrot@uni-bremen.de David Rotermund] In a first step we build a dummy torch layer from a nn.Module. It contains only the learning rate as a registered parameter:<syntaxhighlight lang="python">my_modul...") Tag: Visual edit
  • 14:5514:55, 21 October 2025 How to take advantage of an optimizer for your non-Pytorch project (hist | edit) [2,361 bytes] Davrot (talk | contribs) (Created page with "Pytorch provides you with optimizer. Their job is to update your parameter (e.g. weights) with a gradient. How can we use it for our own stimulation, without using the rest of PyTorch? Questions to [mailto:davrot@uni-bremen.de David Rotermund] In a first step we build a dummy torch layer from a '''nn.Module'''. It contains a registered parameter: (here it is the weight). == Dummy torch layer == <syntaxhighlight lang="python">import torch my_module: torch.nn.Module =...") Tag: Visual edit
  • 14:5314:53, 21 October 2025 Unfold: How to manually calculate the indices for a sliding 2d window (hist | edit) [4,378 bytes] Davrot (talk | contribs) (Created page with "Sometimes it is important to get the all the indices that correspond to the elements in one window position of a CNN or pooling operation. In a simple case you could do it by hand. But what if you have padding, dilation beside the input size, kernel size and stride? Anyway, who would do it by hand if PyTorch can do it for you? Questions to [mailto:davrot@uni-bremen.de David Rotermund] == The problem == Assume we have a 28x28 input image and a 5x5 kernel & stride o...") Tag: Visual edit
  • 14:5214:52, 21 October 2025 Replace the automatic autograd with your own torch.autograd.Function (hist | edit) [10,744 bytes] Davrot (talk | contribs) (Created page with "Questions to [mailto:davrot@uni-bremen.de David Rotermund] == [https://pytorch.org/docs/stable/notes/extending.html#extending-autograd Extending torch.autograd] == === [https://pytorch.org/docs/stable/notes/extending.html#when-to-use When to use] === <blockquote>In general, implement a custom function if you want to perform computations in your model that are not differentiable or rely on non-PyTorch libraries (e.g., NumPy), but still wish for your operation to chain w...") Tag: Visual edit
  • 14:5014:50, 21 October 2025 Write your own layer (hist | edit) [4,682 bytes] Davrot (talk | contribs) (Created page with "Questions to [mailto:davrot@uni-bremen.de David Rotermund] == Writing a layer based on linear == I am rewriting the code for [https://pytorch.org/docs/stable/_modules/torch/nn/modules/linear.html#Linear Linear] as my own layer. __init__(): It contains a tensor for the weights and optionally a second tensor for the bias. Both tensors are wrapped within the torch.nn.Parameter class. This is necessary, otherwise the optimizer will not find them. Afterwards the tensors wil...") Tag: Visual edit
  • 14:3214:32, 21 October 2025 Train the network (hist | edit) [34,741 bytes] Davrot (talk | contribs) (Created page with "Training the weights and biases of the network. Questions to [mailto:davrot@uni-bremen.de David Rotermund] == An example setup == === Network === '''Note: Okay, I forgot the full layer somehow but it is still at 99%.'''<syntaxhighlight lang="python">import torch # Some parameters input_number_of_channel: int = 1 input_dim_x: int = 24 input_dim_y: int = 24 number_of_output_channels_conv1: int = 32 number_of_output_channels_conv2: int = 64 number_of_output_channels_fl...") Tag: Visual edit
  • 14:2814:28, 21 October 2025 Creating networks (hist | edit) [40,546 bytes] Davrot (talk | contribs) (Created page with "In these days, building networks is very important. Questions to [mailto:davrot@uni-bremen.de David Rotermund] == A fast way to build a network with [https://pytorch.org/docs/stable/generated/torch.nn.Sequential.html#torch.nn.Sequential Sequential] == <syntaxhighlight lang="python">CLASS torch.nn.Sequential(*args: Module)</syntaxhighlight><blockquote>A sequential container. Modules will be added to it in the order they are passed in the constructor.</blockquote>Example...") Tag: Visual edit
  • 14:2514:25, 21 October 2025 Layers (hist | edit) [26,299 bytes] Davrot (talk | contribs) (Created page with "Layers, layers, everywhere. If you understand PyTorch layers then you understand most of PyTorch. Well, and torch.tensor… Questions to [mailto:davrot@uni-bremen.de David Rotermund] Open Book & Website recommendation If you don’t know what these layers mean then don’t be ashamed and check out these resources: Dive into Deep Learning https://d2l.ai/ as well as corresponding Youtube channel from [https://www.youtube.com/playlist?list=PLZSO_6-bSqHQHBCoGaObUlj...") Tag: Visual edit
  • 09:5109:51, 21 October 2025 Data augmentation (hist | edit) [19,210 bytes] Davrot (talk | contribs) (Created page with "What is available as data augmentation methods in torchvision? Questions to [mailto:davrot@uni-bremen.de David Rotermund] Initial Image: Initial Image Photo by Udo Ernst == Loading an example image (with opencv2) == Load it via [https://docs.opencv.org/4.5.3/d4/da8/group__imgcodecs.html#ga288b8b3da0892bd651fce07b3bbd3a56 cv2.imread( filename[, flags]) -> retval]<syntaxhighlight lang="python">import cv2 import matplotlib....") Tag: Visual edit
  • 09:4809:48, 21 October 2025 Interfacing Data (hist | edit) [3,648 bytes] Davrot (talk | contribs) (Created page with "We need to handle our data and make it accessible for PyTorch. Questions to [mailto:davrot@uni-bremen.de David Rotermund] There are options to interface your data. == [https://pytorch.org/docs/stable/data.html#torch.utils.data.TensorDataset torch.utils.data.TensorDataset] == <syntaxhighlight lang="python">CLASS torch.utils.data.TensorDataset(*tensors)</syntaxhighlight><blockquote>Dataset wrapping tensors. Each sample will be retrieved by indexing tensors along the fi...") Tag: Visual edit
  • 09:4709:47, 21 October 2025 Converting the original MNIST files into numpy (hist | edit) [6,981 bytes] Davrot (talk | contribs) (Created page with "Questions to [mailto:davrot@uni-bremen.de David Rotermund] '''I will use Linux. You will need a replacement for gzip under Windows.''' == Download the files == We need to download the MNIST database files * t10k-images.idx3-ubyte.gz * t10k-labels.idx1-ubyte.gz * train-images.idx3-ubyte.gz * train-labels.idx1-ubyte.gz A source for that is for example https://www.kaggle.com/datasets/hojjatk/mnist-dataset?resource=download == Unpack the gz files == In a terminal:<synta...") Tag: Visual edit
  • 09:4609:46, 21 October 2025 Get CUDA ready! (hist | edit) [4,667 bytes] Davrot (talk | contribs) (Created page with "Convince PyTorch and Nvidia’s GPUs working together. '''I assume you installed the PyTorch and/or TensorFlow version for CUDA. (see Python installation instructions on this site…)''' Questions to [mailto:davrot@uni-bremen.de David Rotermund] == Windows / Linux == * Download and install [https://developer.nvidia.com/cuda-downloads CUDA driver] * Download and install [https://developer.nvidia.com/rdp/cudnn-download cuDNN toolkit] (you will need to create an account...") Tag: Visual edit
  • 09:3509:35, 21 October 2025 How to read a webcam with CV2 (hist | edit) [1,751 bytes] Davrot (talk | contribs) (Created page with "We want to capture the webcam via CV2. Questions to [mailto:davrot@uni-bremen.de David Rotermund]<syntaxhighlight lang="shell">pip install opencv-contrib-python</syntaxhighlight><syntaxhighlight lang="python">import numpy as np import cv2 def record_video( camera_index: int, n_frames: int, fps: float = 20.0, framesize: tuple[int, int] = (640, 480), display: bool = False, ) -> tuple[bool, np.ndarray]: cap = cv2.VideoCapture(camera_index) asse...") Tag: Visual edit
  • 09:3009:30, 21 October 2025 OpenCV2: Play, write, read a video (hist | edit) [4,654 bytes] Davrot (talk | contribs) (Created page with "How to playback a video? Howto save it into a mp4 file? Howto load from a mp4 file? Questions to [mailto:davrot@uni-bremen.de David Rotermund] == Write the video into a mp4 file == <syntaxhighlight lang="python"> import numpy as np import cv2 # type: ignore import tqdm # type: ignore def write_video(frames: np.ndarray, filename: str = "test", fps: float = 20.0) -> None: assert len(filename) > 0, "write_video: Filename is empty." assert frames.size > 0, "wri...") Tag: Visual edit
  • 09:2709:27, 21 October 2025 Austin: Time and memory profiling (hist | edit) [1,824 bytes] Davrot (talk | contribs) (Created page with "We want to see where your Python program requires the most processing time and memory. For this we will use a time- and memory profiler called Austin. Questions to [mailto:davrot@uni-bremen.de David Rotermund] == Installing Austin == Obviously, first we need to get [https://github.com/p403n1x87/austin Austin]. On the Austin website, there a several methods described how to install it. === Linux as user === Compiling<syntaxhighlight lang="shell">git clone --depth=1 htt...") Tag: Visual edit
  • 09:2409:24, 21 October 2025 ZeroMQ: Microservices as well as connecting computers via message queue (hist | edit) [6,127 bytes] Davrot (talk | contribs) (Created page with "[https://zeromq.org/get-started/ ZeroMQ] is a simple to implement way to transfer data between server & client application. It is available for a vast range of programming languages. Including Python [https://pyzmq.readthedocs.io/en/latest/index.html PyZMQ]. It has a [https://zguide.zeromq.org/ lot of options], including broadcasting. I will only present a very simple example because most of it we don’t need. Questions to [mailto:davrot@uni-bremen.de David Roterm...") Tag: Visual edit
  • 09:2209:22, 21 October 2025 Psutil vs os.cpu count: How many "CPUs" do I have? (hist | edit) [1,574 bytes] Davrot (talk | contribs) (Created page with "How man “CPUs” do I have in this computer? We need this information for multi-processing. Questions to [mailto:davrot@uni-bremen.de David Rotermund] == os.cpu_count == We get the core count inclusive the virtual hyper threading cores. But it is included in Python:<syntaxhighlight lang="python">import os # If -1 then it looks up the amount of available CPU HT cores number_of_cpu_processes: int = -1 number_of_cpu_processes_temp = os.cpu_...") Tag: Visual edit
  • 09:2109:21, 21 October 2025 Argh: Organize your command line arguments (hist | edit) [3,627 bytes] Davrot (talk | contribs) (Created page with "Argh helps to handle command line arguments in a big way. Don’t use the build-in Python stuff for that. Questions to [mailto:davrot@uni-bremen.de David Rotermund]<syntaxhighlight lang="shell">pip install argh</syntaxhighlight> == Simple example == === No argument is required === The arguments are now only optional for the function call:<syntaxhighlight lang="python">import argh def main(first_parameter: int = 1, second_parameter: int = 2, third_parameter: bool = T...") Tag: Visual edit
  • 09:2009:20, 21 October 2025 TQDM: Make your progress visible (hist | edit) [568 bytes] Davrot (talk | contribs) (Created page with "[https://tqdm.github.io/ TQDM] : Introducing a nice progress bar for for loops. Questions to [mailto:davrot@uni-bremen.de David Rotermund]<syntaxhighlight lang="shell">pip install tqdm</syntaxhighlight> == trange == You can just replace range by trange:<syntaxhighlight lang="python">from tqdm import trange import time for i in trange(0, 10): time.sleep(1)</syntaxhighlight><syntaxhighlight lang="python"> 30%|███ | 3/10 [00:03<00:07, 1.12s/it]</syntaxhi...") Tag: Visual edit
  • 09:1609:16, 21 October 2025 Linearize the spectral coherence (hist | edit) [8,437 bytes] Davrot (talk | contribs) (Created page with "Questions to [mailto:davrot@uni-bremen.de David Rotermund] Let us assume we have two time series (white in spectrum) <math display="inline">x_1(t)</math> and <math display="inline">x_2(t)</math>. Both are linearly mixed together via a mixing coefficient <math display="inline">\alpha</math>: <math display="block">y(t) = (1- \alpha) x_1(t) + \alpha * x_2(t)</math> Wouldn’t it to be nice if the spectral coherence would be <math display="inline">\alpha</math>? For whit...") Tag: Visual edit
  • 09:1409:14, 21 October 2025 Instantanious Spectral Coherence (hist | edit) [11,724 bytes] Davrot (talk | contribs) (Created page with "Questions to [mailto:davrot@uni-bremen.de David Rotermund] == Test data == <syntaxhighlight lang="python">import numpy as np import matplotlib.pyplot as plt dt: float = 1.0 / 1000.0 # I want more trials f_base: float = 50 f_delta: float = 1 rng = np.random.default_rng(1) n_t: int = 1000 n_trials: int = 1 t: np.ndarray = np.arange(0, n_t) * dt amplitude: float = 0.75 x = dt * 2.0 * np.pi * (f_base + f_delta * 2 * (rng.random((n_t, n_trials)) - 0.5)) x = np.cumsum(x,...") Tag: Visual edit
  • 09:1009:10, 21 October 2025 PyWavelets: Wavelet Transforms in Python (hist | edit) [17,965 bytes] Davrot (talk | contribs) (Created page with "How do we do wavelet transforms under Python? Questions to [mailto:davrot@uni-bremen.de David Rotermund] You might want to read: [https://paos.colorado.edu/research/wavelets/ A Practical Guide to Wavelet Analysis] -> [https://paos.colorado.edu/research/wavelets/bams_79_01_0061.pdf PDF]<syntaxhighlight lang="shell">pip install PyWavelets</syntaxhighlight> == Which [https://pywavelets.readthedocs.io/en/latest/ref/cwt.html#continuous-wavelet-families continuous moth...") Tag: Visual edit
  • 08:4208:42, 21 October 2025 Flow chart for baking bread (hist | edit) [1,739 bytes] Davrot (talk | contribs) (Created page with "Disassembling the process of baking bread as a flow chart. Questions to [mailto:davrot@uni-bremen.de David Rotermund] == Baking bread == {% raw %}<pre class="mermaid"> graph TD A(["Start"]) --> B{"Ingredients Ready?"} B -->|"Yes"| C("Preheat Oven") B -->|"No"| D"Gather Ingredients" D --> C C --> md"Make Dough" --> E("Knead Dough") E --> F{"First Rise Complete?"} F -->|"Yes"| G("Punch Down Dough") F -->|"No"| E G --> H("Sh...") Tag: Visual edit
  • 08:3308:33, 21 October 2025 Examples (hist | edit) [3,687 bytes] Davrot (talk | contribs) (Created page with "Looking into some flow chart examples. Questions to [mailto:davrot@uni-bremen.de David Rotermund] == Most simple program == This program does nothing. {% raw %}<pre class="mermaid"> flowchart TD start([Start])-->stop([Stop]) </pre>{% endraw %} In Python:<syntaxhighlight lang="python">pass</syntaxhighlight> == a+b=c == {% raw %}<pre class="mermaid"> flowchart TD start([Start]) --> inita{{"a ← 1"}} --> initb{{"b ← 1"}} --> add("c ← a+b") --...") Tag: Visual edit

20 October 2025

17 October 2025

  • 15:4115:41, 17 October 2025 K Nearest Neighbours (pure numpy) (hist | edit) [2,449 bytes] Davrot (talk | contribs) (Created page with "Questions to [mailto:davrot@uni-bremen.de David Rotermund] == Test and train data == <syntaxhighlight lang="python">import numpy as np rng = np.random.default_rng(1) a_x: np.ndarray = rng.normal(1.5, 1.0, size=(1000))[:, np.newaxis] a_y: np.ndarray = rng.normal(3.0, 1.0, size=(1000))[:, np.newaxis] data_train_0: np.ndarray = np.concatenate((a_x, a_y), axis=-1) class_train_0: np.ndarray = np.full((data_train_0.shape[0],), -1) a_x = rng.normal(1.5, 1.0, size=(1000))[:,...") Tag: Visual edit
  • 15:4015:40, 17 October 2025 ROC (pure numpy) (hist | edit) [3,606 bytes] Davrot (talk | contribs) (Created page with "Questions to [mailto:davrot@uni-bremen.de David Rotermund] The following code is for the case where the amount of data for both classes is the same. == Test data == <syntaxhighlight lang="python">import numpy as np import matplotlib.pyplot as plt rng = np.random.default_rng(1) a_x = rng.normal(1.5, 1.0, size=(5000)) b_x = rng.normal(0.0, 1.0, size=(5000)) ab_x = np.concatenate([a_x, b_x]) edges = np.histogram_bin_edges(ab_x, bins=100, range=None, weights=None) h_a...") Tag: Visual edit
  • 15:3615:36, 17 October 2025 Support Vector Machine (hist | edit) [4,906 bytes] Davrot (talk | contribs) (Created page with "== Top == Questions to [mailto:davrot@uni-bremen.de David Rotermund] == [https://scikit-learn.org/stable/modules/generated/sklearn.svm.SVC.html sklearn.svm.SVC] == <syntaxhighlight lang="python">sklearn.svm.SVC(*, C=1.0, kernel='rbf', degree=3, gamma='scale', coef0=0.0, shrinking=True, probability=False, tol=0.001, cache_size=200, class_weight=None, verbose=False, max_iter=-1, decision_function_shape='ovr', break_ties=False, random_state=None)</syntaxhighlight><blockquo...") Tag: Visual edit
  • 15:3515:35, 17 October 2025 FastICA (hist | edit) [9,738 bytes] Davrot (talk | contribs) (Created page with "== The goal == Questions to [mailto:davrot@uni-bremen.de David Rotermund] == Test data == We rotate the blue dots with ​a non-orthogonal rotation matrix into the red dots.<syntaxhighlight lang="python">import numpy as np import matplotlib.pyplot as plt rng = np.random.default_rng(1) a_x = rng.normal(0.0, 1.0, size=(5000))[:, np.newaxis] a_y = rng.normal(0.0, 1.0, size=(5000))[:, np.newaxis] ** 3 data_a = np.concatenate((a_x, a_y), axis=1) b_x = rng.normal(0.0, 1.0,...") Tag: Visual edit
  • 15:0815:08, 17 October 2025 PCA (hist | edit) [12,341 bytes] Davrot (talk | contribs) (Created page with "== The goal == PCA allows to extract an orthogonal basis system for a set of data. Questions to [mailto:davrot@uni-bremen.de David Rotermund] == Test data == <syntaxhighlight lang="python">import numpy as np import matplotlib.pyplot as plt rng = np.random.default_rng(1) a_x = rng.normal(0.0, 1.0, size=(5000))[:, np.newaxis] a_y = rng.normal(0.0, 1.0, size=(5000))[:, np.newaxis] ** 3 data_a = np.concatenate((a_x, a_y), axis=1) b_x = rng.normal(0.0, 1.0, size=(5000))[...") Tag: Visual edit
  • 15:0415:04, 17 October 2025 KMeans (hist | edit) [9,397 bytes] Davrot (talk | contribs) (Created page with "== The goal == KMeans allows to find clusters in a data set. Questions to [mailto:davrot@uni-bremen.de David Rotermund] == Test data == <syntaxhighlight lang="python">import numpy as np import matplotlib.pyplot as plt rng = np.random.default_rng(1) rng = np.random.default_rng() a_x = rng.normal(1.5, 1.0, size=(1000)) a_y = rng.normal(3.0, 1.0, size=(1000)) b_x = rng.normal(0.0, 1.0, size=(1000)) b_y = rng.normal(0.0, 1.0, size=(1000)) plt.plot(a_x, a_y, "c.") plt....") Tag: Visual edit
  • 15:0015:00, 17 October 2025 Sci-kit Overview (hist | edit) [50,663 bytes] Davrot (talk | contribs) (Created page with "== The goal == [https://scikit-learn.org/stable/index.html scikit-learn] is a machine learning tool kit for data analysis. Questions to [mailto:davrot@uni-bremen.de David Rotermund]<syntaxhighlight lang="shell">pip install scikit-learn</syntaxhighlight><blockquote>* Simple and efficient tools for predictive data analysis * Accessible to everybody, and reusable in various contexts * Built on NumPy, SciPy, and matplotlib </blockquote>'''I will keep it short and I will ma...") Tag: Visual edit
  • 14:5614:56, 17 October 2025 Scipy.signal: Butterworth low, high and band-pass (hist | edit) [4,344 bytes] Davrot (talk | contribs) (Created page with "== The goal == Sometimes we need to remove of frequency range from a time series. For this we can use a Butterworth filter [https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.butter.html scipy.signal.butter] and the [https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.filtfilt.html scipy.signal.filtfilt] command. Questions to [mailto:davrot@uni-bremen.de David Rotermund] {| class="wikitable" |[https://docs.scipy.org/doc/scipy/reference/gener...") Tag: Visual edit
  • 14:5214:52, 17 October 2025 Remove a common signal from your data with SVD (hist | edit) [3,926 bytes] Davrot (talk | contribs) (Created page with "== Goal == We want to remove a common signal which was mixed on top a set of data channels. There are many methods to do so. We will use SVD. Implementations are for example: [https://docs.scipy.org/doc/scipy/reference/generated/scipy.linalg.svd.html scipy.linalg.svd] or [https://pytorch.org/docs/stable/generated/torch.svd_lowrank.html torch.svd_lowrank] (which also works on the GPU) Questions to [mailto:davrot@uni-bremen.de David Rotermund] == Creating dirty test data...") Tag: Visual edit
  • 14:3614:36, 17 October 2025 Subplots and gridspec: A more flexible placement (hist | edit) [12,543 bytes] Davrot (talk | contribs) (Created page with " = subplots and gridspec = {:.no_toc} <nav class="toc-class"> * TOC {:toc} </nav> == Top == Questions to [mailto:davrot@uni-bremen.de David Rotermund] == Example 1 (2d regular grid) == '''subplots with s at the end!!!'''<syntaxhighlight lang="python">import numpy as np import matplotlib.pylab as plt rng = np.random.default_rng() a = rng.random((100, 100)) fig, axs = plt.subplots(nrows=3, ncols=3) print(axs.shape) # -> (3, 3) for x in range(0, axs.shape[0]):...") Tag: Visual edit
  • 14:3514:35, 17 October 2025 Overview of the available functions (hist | edit) [16,146 bytes] Davrot (talk | contribs) (Created page with "== The goal == There a lot of functions in matplotlib.pyplot. Here I list the more important ones. Questions to [mailto:davrot@uni-bremen.de David Rotermund]<blockquote>'''pylab''' is a historic interface and '''its use is strongly discouraged'''. The equivalent replacement is matplotlib.pyplot</blockquote> == [https://matplotlib.org/stable/api/pyplot_summary.html#managing-figure-and-axes Managing Figure and Axes] == {| class="wikitable" |[https://matplotlib.org/stable...") Tag: Visual edit
  • 14:3314:33, 17 October 2025 Animation and Slider (hist | edit) [9,797 bytes] Davrot (talk | contribs) (Created page with "== The goal == Sometimes a static picture is not enough. Here we will produce an animation from data as well as make data interactively inspectable. Questions to [mailto:davrot@uni-bremen.de David Rotermund] == Test data == <syntaxhighlight lang="python">import numpy as np import matplotlib.pyplot as plt axis = np.arange(-100, 101) / 100.0 x = axis[:, np.newaxis, np.newaxis].copy() y = axis[np.newaxis, :, np.newaxis].copy() z = axis[np.newaxis, np.newaxis, :].copy()...") Tag: Visual edit
  • 14:2914:29, 17 October 2025 Subplot (hist | edit) [4,114 bytes] Davrot (talk | contribs) (Created page with "== The goal == Questions to [mailto:davrot@uni-bremen.de David Rotermund] == [https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.subplot.html matplotlib.pyplot.subplot] == <syntaxhighlight lang="python">matplotlib.pyplot.subplot(*args, **kwargs)</syntaxhighlight><blockquote>Add an Axes to the current figure or retrieve an existing Axes. This is a wrapper of Figure.add_subplot which provides additional behavior when working with the implicit API (see the notes...") Tag: Visual edit
  • 14:2714:27, 17 October 2025 Simple plot and imshow examples (hist | edit) [20,097 bytes] Davrot (talk | contribs) (Created page with "== The goal == Questions to [mailto:davrot@uni-bremen.de David Rotermund]<blockquote>'''pylab''' is a historic interface and '''its use is strongly discouraged'''. The equivalent replacement is matplotlib.pyplot</blockquote> == Simple example with plot == <div class="figure"> File:6 0.png </div><syntaxhighlight lang="python">import numpy as np import matplotlib.pyplot as plt # type: ignore f: float = 10 t = np.linspace(0, 1.0, 10000) y = np.sin(t * 2 * np.pi * f)...") Tag: Visual edit
(newest | oldest) View ( | ) (20 | 50 | 100 | 250 | 500)