Hans Peterson

Greenhorn
+ Follow
since Apr 30, 2019
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Hans Peterson

I want to implement the LMS algorithm. First, I generate the inputs in the intervall [0,5] with 51 entries. A function y gives me the outputs. The target values are calculated from y. Therefore I add a random number to y.

Psi soll eine Transformation darstellen der Form (1,x,x^d)
Where Psi is a transformation Psi(x) = (1,x,x^d). To calculate the gradient, I followed these Script. I set g to w so that both vectors have the same shape.



In the final step, I called the gradient function within the LMS implementation


When I finally call the functiom LMS, I do not get an error, but the algorithm does not determin. I probably have done something wrong with the gradient implementation but I can't figure out what.
I hope somebody can help me here.
Thanks
4 weeks ago
It now works out fine. In

I made brackets at d1,d2 because I had defined them as a function first.
6 months ago
Thanks for your help, that worked out for me. Unfortunately I now get the error:


TypeError: 'numpy.float64' object is not callable


in

I'm still wondering why it worked out fine when I didn't tried to read the values from the bash.
6 months ago
Thanks for your help. Yes I ment the Boolean Satisfiability Problem.
6 months ago
So I have this code snipe:

where calc_lib is another file with the function:

Now I get the error:


d1 =  (np.log(S0/K) + (r + sigma**2 / 2) * T)/(sigma * np.sqrt(T))
TypeError: unsupported operand type(s) for /: 'int' and 'str'


which I just don't understand because i forced my inputs to be a float and therefor this shouldn't give me an error.
Can somebody help me here out?
The function does work if I define values instead of reading them from the bash.
6 months ago
This is for sure not a java questoin but I have really no idea where to post it else: Given is a yes/no problem P for the instance n. There is an existing reduction from P to Q with the timecomplexity O(n^2). Q is also NP-complete.
Now asume that the problem Q can be solved in O(m^2 log(m)) with the input parameter m. Does this implicate, that every instance of sat can be solved in polynomical time?
6 months ago
This is for sure not a java questoin but I have really no idea where to post it else: Given is a yes/no problem P for the instance n. There is an existing reduction from P to Q with the timecomplexity O(n^2). Q is also NP-complete.
Now asume that the problem Q can be solved in O(m^2 log(m)) with the input parameter m. Does this implicate, that every instance of sat can be solved in polynomical time?
6 months ago
Given is the B-Tree I added as attachement. I now want to delet the 26. Why are the B-Tree criteria broken right after the deletion?
Thanks for your help.
6 months ago
Thanks for youre help folks. It's clear now
7 months ago
Thank you I think I got the first part now.

the second loop runs in Θ(n)


Why isn't the loop running n^2 times? Still I don't quite understand why it runs n^2 times but I tested it until n = 5 and the result always was n^2 times:
n=1 -> z =0+0+1 = 1
n=2 -> z=1+1+2 = 4
n=3 -> z=4+2+3 = 9
n=4 -> z= 9+3+4 = 16
n=5 -> z=16+4+5 = 25

P.S: Is there a Latex mode or something so I can write down the maths a little bit more structured like you?
7 months ago

It doesn't. a = 2^log₂(n)


Why is this so? Let n be 7. Then log_2(n) is approximately 2.8. Since the loop only repeats until i>2.8 it has 2 steps.
First step: i = 2, a = 2
Second step: i = 3, a = 4

a will allways be a multiple of 2. Thats why I thought I'm not interested in the decimals when I calculate log_2(n).
7 months ago
I'm not sure in which Forum to post this question so I put it in Java in General. Please tell me if you know a better fit for this question because I have the feeling I will post some of these in the following days ;)
I'm looking for the return value as a functoin of n in big theta notation for the following pseudo code:


The first (repeat) loop goes (in principle) n/log_2(n) times only that the rest in the division doesn't matter. So I'm looking here for a mathematical way to display only positiv integer. Maybe with the modulo function?
The for loop runs exactly a times and therefore (imagine the result of the division is a positiv integer) has 2* n/log_2(n) calls.
For z I get the value z = n*(2j+1) because in the first step j=0 and z is n since z= 0 +0 +n = (j+1)*n.
Can somebody confirm my results an help me out with the first loop?


7 months ago
Actually I'm not trying to implement the quicksort algorithm. I'm trying to implement this algorithm wich hasn't a verry detailed pseudo code.
7 months ago
I want to implement the samplesort algorithm and would need help since I couldn't find some java code in the internet so I work with the Pseudo Code from Wikepedia. So far I have this Code:

which isn't verry much. My biggest Problem is, that I don't now much about this algorithm and I also don't find much on the internet.
So referring to the Pseudo Code on Wikepedia, I sorted the Samples. In the last step I inplemented my pivot elements with the elements from Sample.
Now I'm stuck. I don't understand how the rest of the pseudo code works because I don't know how to find j.
So somebody could make me very happy if he can help me to finish this algorithm.
7 months ago
I'm not quite sure if I understand your algorithm right.
First I define 5 as my root, so I have the elements 3,1,2,4 which are smaller than five and therefore are on the leftside and the elements 8,7,6,9 which are greater than 5 and therefor are on the rightside.
In the next step I compaare 1,2 and 5 to 3. Is this right?
So 1 comes to the left side of the subtree and 3 to the rightside. In the end, 2 is greater than 1 and therefore stands on the rightside.
The same way are the elements on the right side placed.
Did I execute your algorithm right?
7 months ago