All Questions
26 questions
3
votes
2
answers
95
views
SineCosine Wave
As a beginner this is my first code. Any comments?
...
4
votes
2
answers
4k
views
Cython with variable-length arrays
Dynamically growing arrays are a type of array. They are very useful when you don't know the exact size of the array at design time. First you need to define an initial number of elements. (Wikipedia)
...
8
votes
1
answer
130
views
Using get_dummies to create a Simple Recommender System - Cold Start
Question: was using get_dummies a good choice for converting categorical strings?
I used get_dummies to convert categorical ...
2
votes
1
answer
91
views
Forecasting stock market data using Support Vector Regression
I coded this Support Vector Regression (SVR) myself following some equations in a journal (see here, or here (not in English)). The loss function used by the journal and the code below is mean ...
4
votes
0
answers
75
views
Importer for binary datafile of PI88 Nanoindenter
As an exercise, I want to rewrite a C++ program to import measurement files (and later create excelsheets, reports ...). The measurement files split in 2 files, a binary file, and a xml-file. Because ...
5
votes
1
answer
601
views
Beginning of a GUI Python solution to Andrew Ng's ML week 3 excercises
Coursera has a course for beginning Machine Learning and the code is written in Octave. This is the beginning of a solution to the week 3 exercises but written in python. Instead of a terminal app I'...
1
vote
1
answer
184
views
k-armed bandit problem in Python
I implemented k-armed bandit problem in C#, MATLAB and Python. C# and Matlab code run fairly fast (With same settings of T = 2000 and nRun = 1000 the elapsed time is about 6sec). However, the Python ...
16
votes
1
answer
406
views
Solve the phase state between two haplotype blocks using markov transition probabilities
I have spent about more than a year in python, but I come from biology background. I should say I have got some understanding of for-loop and nested-for-loop to workout the solution to the problem I ...
5
votes
1
answer
214
views
Using NumPy to scale data in 2 out of 3 columns
The below code takes a csv containing age, weight, height and prints the betas determined through linear regression to an output csv. It runs for 10 iterations using a different alpha for each, and ...
5
votes
1
answer
5k
views
Applying Laplacian smoothing to vertices in a mesh
I'm totally new in Python and I wrote some code. It is a simple algorithm to smooth objects. I need to find adjacent vertices in mesh and sum their coordinates and after that divide by a number of ...
4
votes
2
answers
342
views
Randomly generate a list with predetermined mean
Aim: randomly generate \$n\$ numbers between \$a\$ and \$b\$ with (roughly) mean \$m\$.
Problem: The simple beginner's code I wrote becomes very inefficient as \$m\$ moves away from \$\frac{a + b}{2}\...
12
votes
3
answers
604
views
Plotting different parameterized polynoms
For a university assignment I had to plot different polynomial functions depending on one single parameter. That parameter gave the number of supporting points to interpolate a given function in the ...
5
votes
1
answer
205
views
Calculating a table of deBroglie wavelengths for various electron energies
Here is the formula for the deBroglie wavelength of an electron versus its kinetic energy:
$$ \lambda(E_k) = h\left/\sqrt{\frac{(E_k+m_eC^2)^2-m_e^2C^4}{C^2}}\right.$$
and here is simple script that ...
6
votes
1
answer
1k
views
Python! (Snake)
This is now an Iterative Review.
Next Iteration
Nowhere near a full game yet. Just a basic overview and initialisation of a Snake() class.
Thoughts?
...
7
votes
1
answer
2k
views
Koch snowflake in Python with numpy and pygame
I've drawn a Koch snowflake with Python 3. I'm new to the Python world and would appreciate all feedback on how to make the code more Pythonic as I'm not used to these idioms, styles and modules. All ...