Skip to main content

All Questions

Tagged with
3 votes
2 answers
95 views

SineCosine Wave

As a beginner this is my first code. Any comments? ...
Arpit's user avatar
  • 131
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) ...
user4933's user avatar
  • 149
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 ...
john taylor's user avatar
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 ...
Ihsanul's user avatar
  • 23
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 ...
natter1's user avatar
  • 288
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'...
ao222's user avatar
  • 53
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 ...
Omid's user avatar
  • 159
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 ...
everestial's user avatar
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 ...
user7875185's user avatar
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 ...
Pagorek's user avatar
  • 51
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}\...
user2738815's user avatar
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 ...
Vogel612's user avatar
  • 25.4k
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 ...
Christian Chapman's user avatar
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? ...
Kaz's user avatar
  • 8,810
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 ...
Anna's user avatar
  • 275

15 30 50 per page