Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 6 years ago.
Improve this question
I'm trying to save numbers in decimal data type filed formated (10,4), but it's not stored as expected ie. 13850 changed to 13.0000 any help.
this is my code:
$c_price = $unit_price*$rate;
$expense->c_price = number_format($c_price, 4);
$expense->c_total = number_format($quantity*$c_price, 4);
Here c_price and c_total values are changed.
Increase the length of digits:
(19,4)
it will work.
Related
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 8 days ago.
Improve this question
I have been changing some params and adding layers and also standardization. But the mmodel seems to stuck at constant high accuracy after 1-2 epoch. Currently at 0.90 Acc both in train and val data.
Samples are heavily imbalanced, class proportion : 10:3:2.
I am using GRU as my model. as the code below :
# Using GRU
seed = 11
tf.keras.backend.clear_session()
np.random.seed(seed)
tf.random.set_seed(seed)
model = Sequential()
model.add(text_vectorization)
model.add(embedding)
model.add(GRU(32, return_sequences=True))
model.add(Dropout(0.5))
model.add(tf.keras.layers.BatchNormalization())
model.add(GRU(32))
model.add(Dropout(0.5))
model.add(tf.keras.layers.BatchNormalization())
model.add(Dense(3,activation='softmax'))
model.compile(loss='categorical_crossentropy', optimizer='adam', metrics='accuracy')
model_gru = model.fit(X_train,y_train,epochs=20,validation_data=(X_test, y_test))
EXpected to have accuracy which is not constant after 1 or 2 epoch.
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 4 years ago.
Improve this question
I know how to plot a sawtooth function (thanks to another forum) but only on the domain [0:10] thanks to the following code which is actually working :
t=0:0.04:10;
A=1;
T=1;
rho= mod(t * A / T, A);
plot(t,rho)
A=the amplitude, T=the period,t=the time interval.
The problem is that I need the same function on the domain [0:35916] but when I try to adapt this code to do so (eg by extending the time interval), I get an error and I don't understand why.
error:
plt2vv: vector lengths must match error: called from plt>plt2vv at line 487 column 5 plt>plt2 at line 246 column 14 plt at line 113 column 17 plot at line 222 column 10
Simply modifying the original upper limit of your interval from 10 to 35916 should do the trick:
t=0:0.04:35916;
A=1;
T=1;
rho= mod(t * A / T, A);
plot(t,rho)
The code above yields the following image:
Of course it is up to you to adjust A and T to suit your needs.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 8 years ago.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Improve this question
I am new to Cuda fortran. I have never worked with higher dimension grids. I just thought to start with this problem, in which i have to assign 1 thread to each cell of a 3-d array of size 46*46*19. Please can someone help me how to design the grid and blocks for this type of array and to compute the thread indices for that.
any help will be appreciated.
I have come up with this, but i don't know how to compute the thread indexes
type(dim3) :: threads,blocks
threads=dim3(16,16,4)
blocks=dim3((xDim + threads%x - 1)/threads%x,(yDim + threads%y - 1)/threads%y,(zDim + threads%z - 1)/threads%z)
The code you've shown in your question is what you would use to set up the kernel launch.
Inside the kernel you could use code like this to generate thread x,y, and z indices:
idx = (blockIdx%x-1) * blockDim%x + threadIdx%x-1
idy = (blockIdx%y-1) * blockDim%y + threadIdx%y-1
idz = (blockIdx%z-1) * blockDim%z + threadIdx%z-1
This would create zero-based indexing. You could omit the -1 at the end of each line of code above to create one-based indexing.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
I need to round the decimals like :
1.00 ->1.0
1.987->1.98
1.93-> 1.93
1.07->1.07
How to do this in mysql?
Here goes some documentation
http://dev.mysql.com/doc/refman/5.0/en/mathematical-functions.html#function_round
Quick answer:
mysql> SELECT ROUND(1.987, 2); = 1.99
OR More what you are looking for
truncate(1.987, 2) = 1.98
From Mysql decimal: floor instead of round
This only makes a difference if you are outputting the number (numerically, 1.0 = 1.00). So:
(case when format(num, 2) = '1.00' then '1.0' else format(num-0.005, 2) end)
The -0.005 is to overcome the fact that format() rounds rather than truncates.
Just like that:
SELECT if(NUMBER mod 1=0,ROUND(NUMBER,1),ROUND(NUMBER,2));
eg.
SELECT IF(1.00 MOD 1=0,ROUND(1.00,1),ROUND(1.00,2)); => 1.0
more info
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I know that saving the geocoded lat,lng in a DB (or other media) ,
is against the Terms Of Use, but what if i "take" that point (of course while displaying it on the map) and instead of saving that lat,lng in the DB , i save:
lat + C , lng + C
where C is some const.
Later when i query from the DB , i query lat - C , lng -C.
Is this legal ? currently i don't have the $10k needed and i do want to use their geocoder.
Thanks
When you steal a wallet and put a own dollar into it, is it legal then?
However: it's not illegal to store the latLng's somewhere as long as you store them there to use them later only inside a Maps-API-application.
https://developers.google.com/maps/faq?hl=en#geocoder_exists