Saturday, January 17, 2026

Memo on my python virtual environments

I use venv. To make one python3.13 -m venv MYENV To activate source ./MYENV/bin/activate To turn off deactivate

Saturday, January 10, 2026

Inferring Class Diagram

# install the package
pip install pylint

# Create the directory if it doesn't exist
mkdir -p diagrams

# Generate the mermaid file
pyreverse core/ -o mmd -d diagrams/

This creates Mermaid *.mmd files in the /diagrams folder.
Now visualize this in Obsidian Excalidraw plugin.
Right click on “Excalidraw” -> “New drawing”.
In the top panel click on More tools icon, select Mermaid to Excalidraw.
Paste *.mmd text into the box.
Done. This creates an drawing with movable elements.

Monday, October 2, 2017

RStudio, GitHub, SSH, RSA

ssh-keygen # generates RSA key pair
brew tap theseal/ssh-askpass
brew install ssh-askpass
brew install Caskroom/cask/xquartz
sudo ln -s /usr/local/bin/ssh-askpass /usr/X11R6/bin/ssh-askpass
ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts # github.com added to the list of known hosts

Tuesday, March 17, 2015

How to look inside of "as" methods in R. To convert one S4 object into another we define "setAs" function and use is as "as". setAs returns a "coerce<-" method. So to look up what is going on one have to look inside of "coerce" For example coercion from MSnSet object into Expression set. getMethod("coerce", signature=c("MSnSet","ExpressionSet")) This returns the code of what exactly is going on during the conversion.

Wednesday, November 12, 2014

Sigmoids

Link to the Rmd file on GitHub

Sigmoid Function

\(\frac{p_1}{(1+e^{-p_2 \times (x - p_3)})}\)

p1 is the full scale from 0 to p1. For logistic regression it is 1. In the later examples it will be hardcoded as 1.

p2 is the sharpness of change.

p3 x position of the 50% height.

sigmoid = function(x, p1, p2, p3) {p1 / (1 + exp(-p2 * (x - p3)))}
curve(sigmoid(x, p1=1, p2=2, p3=-3), from=-10, to=+10)
abline(v=-3, lty=2)

plot of chunk chunk1


Sigmoid that starts at zero.

Sometimes we want to convert a parameter that varies only as \((0,+\infty)\) instead of \((-\infty,+\infty)\). First, to convert x form \((0,+\infty)\) to \((-\infty,+\infty)\) we’ll take the log. The formular for the sigmoid/logistic curve will be transformed as…

\(\frac{1}{(1+e^{-p_2 \times (log(\frac{x}{p_3}))})}\)

sigmoid2 = function(x, p2, p3) {1 / (1 + exp(-p2 * (log(x/p3))))}
curve(sigmoid2(x, p2=20, p3=3), from=0.01, to=+10)
abline(v=3, lty=2)

plot of chunk chunk1a


Transformed Positive Sigmoid

If we move p2 inside the log followed by logarithm exponentiation we’ll get

\(\frac{1}{1+(\frac{p_3}{x})^{p_2}}\)

sigmoid3 = function(x, p2, p3) {1 / (1 + (p3/x)^p2)}
curve(sigmoid3(x, p2=20, p3=3), from=0.01, to=+10)
abline(v=3, lty=2)
# smoother
curve(sigmoid3(x, p2=4, p3=3), from=0.01, to=+10, add=T, col='navyblue')

plot of chunk chunk1b

In case we need to model an opposite dependency the trend has to be reversed. For example we want to formalize a probablity of chemical compound being missed in analysis as a function of intensity.

\(\frac{1}{1+(\frac{x}{p_3})^{p_2}}\)

sigmoid3 = function(x, p2, p3) {1 / (1 + (x/p3)^p2)}
curve(sigmoid3(x, p2=20, p3=3), from=0.01, to=+10)
abline(v=3, lty=2)
# smoother
curve(sigmoid3(x, p2=4, p3=3), from=0.01, to=+10, add=T, col='navyblue')

plot of chunk chunk1c


Arctangent

Another way of modeling sigmoid dependency.

\(\frac{2}{\pi} \times arctan((x-p3) \times p2)\)

The notation of parameters as above:

p2 - shaprness

p3 - position of 50% change

sigmoid2 = function(x, sharpness, threshold) (2/pi)*atan((x-threshold)*sharpness)
curve(sigmoid2(x, sharpness=1, threshold=2), from=-10, to=+10)
curve(sigmoid2(x, sharpness=3, threshold=2), from=-10, to=+10, add=TRUE, col='blue')
abline(v=2)

plot of chunk chunk2

Checking font availability on Mac   fc-list : family | grep "Fira Code"   or   system_profiler -json SPFontsDataType | grep \...