Create a pivot table - jasper-reports

I have the below excel data(and it is my backend)
Date Editor Units
7/1/2013 Amreen 158
7/2/2013 Amreen 23
7/3/2013 Amreen 1
7/6/2013 Amreen 33
7/3/2013 Amreen 77
7/3/2013 Amreen 66
7/3/2013 Anirudh 748
7/3/2013 Amreen 8
7/6/2013 Amreen 402
7/7/2013 Amreen 24
7/7/2013 Amreen 146
7/9/2013 Amreen 33
7/8/2013 Amreen 45
7/8/2013 Amreen 21
I want to create a pivot table using JasperReports. I'm new to this technology or framework(i'm not sure of what it is to be said as), can anybody help me to get the table in the below format with explanation. I'm really confused and unable to understand how to do it.
Amreen Anirudh Anand Total
7/1/2013 158 158
7/2/2013 23 23
7/3/2013 152 748 900
7/4/2013
7/5/2013
7/6/2013 435 435
7/7/2013 170 170
7/8/2013 66 66
7/9/2013 33 33 66
Total 1037 748 33 1818
if not the solution please give me a reference of this type of instances (Excel and JasperReports pivot).

Use the Cross table, with Edit in Column and Date in Row and Unit as sum in the middle.

You should be using Crosstab from the Palette. First create a datasource for you report which can be excel or any RDBMS. Then when you drag and drop the Crosstab from the palette a wizard will open. Just follow the wizard and your Pivot table will be done in no time. I hope this helps. For more info link

Related

MySQL adding extra rows to a selection

Is it possible to format somehow the MySQL SELECT query, so if the records contain nonconsecutive numbers, the missing numbers to be added accordingly, i.e. if the database contains
765
767
768
769
772
773
778
779
780
the returned query to look like this:
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
The trick was to get the consecutive numbers from a dummy table and LEFT JOIN the two tables.

Stopping criteria for fminsearch in Matlab

I am using fminsearch to fit parameters for a system of DEs to observed data. I am not expecting to get a great fit.
fminsearch pretty quickly finds what appears to be an acceptable min for the objective function, but then does not stop. It's running for a really long time, and I cannot figure out why.
I am using the options
options = optimset('Display','iter','TolFun',1e-4,'TolX',1e-4,'MaxFunEvals',1000);
which I understood to mean that when the value of the objective function drops to below 1e-4 that would be considered sufficient. Alternatively when they could no longer change the parameters whatever is the best would be returned.
The output is
Iteration Func-count min f(x) Procedure
0 1 8.13911e+10
1 8 7.2565e+10 initial simplex
2 9 7.2565e+10 reflect
3 10 7.2565e+10 reflect
4 11 7.2565e+10 reflect
5 12 7.2565e+10 reflect
6 13 7.2565e+10 reflect
7 15 6.85149e+10 expand
8 16 6.85149e+10 reflect
9 17 6.85149e+10 reflect
10 19 6.20681e+10 expand
11 20 6.20681e+10 reflect
12 22 5.55199e+10 expand
13 23 5.55199e+10 reflect
14 25 4.86494e+10 expand
15 26 4.86494e+10 reflect
16 27 4.86494e+10 reflect
17 29 3.65616e+10 expand
18 30 3.65616e+10 reflect
19 31 3.65616e+10 reflect
20 33 2.82946e+10 expand
21 34 2.82946e+10 reflect
22 36 2.02985e+10 expand
23 37 2.02985e+10 reflect
24 39 1.20011e+10 expand
25 40 1.20011e+10 reflect
26 41 1.20011e+10 reflect
27 43 5.61651e+09 expand
28 44 5.61651e+09 reflect
29 45 5.61651e+09 reflect
30 47 2.1041e+09 expand
31 48 2.1041e+09 reflect
32 49 2.1041e+09 reflect
33 51 5.15751e+08 expand
34 52 5.15751e+08 reflect
35 53 5.15751e+08 reflect
36 55 7.99868e-05 expand
37 56 7.99868e-05 reflect
38 58 7.99835e-05 reflect
39 59 7.99835e-05 reflect
I have previously let this run for a lot longer and it's stuck with the same min f(x) for at least the next 30 print outs.
How do I set the options correctly so that when it finds a solution within an acceptable value for the objective function it stops?
Matlab requires that both TolX AND TolFun be satisfied before terminating ("Unlike other solvers, fminsearch stops when it satisfies both TolFun and TolX." See: https://www.mathworks.com/help/matlab/ref/fminsearch.html). You should check what the "x" value (your solution) is doing. I suspect that is changing more than your tolerance specification for each step. (i.e. the value of x is changing more than TolX between iterations but f(x) is not changing by more than TolFun).

Getting started with LibSVM for a particular case

I have read quite a lot about LibSVM library, but I would like to ask you for some advices in my particular case. The problem is that I have some 3D medical images (DCE-MRI) of a stomach. My goal is to perform a segmentation of a kidney, and find its three parts. Therefore, I need to train a classifier - I'm going to use SVM and neural network
Feature vectors:
What is available is the pixel (voxel) brightness value (I guess the value range is [0; 511]). In total, there are 71 frames, each taken every second. So the crucial feature of every voxel is how the voxel brightness/intensity is changing during the examination time. In my case, every part of a kidney has a different chart (see an example below), so the way how the voxels brightness is changing over the time will be used by the classifier.
Training sets:
Every training set is a vector of intensity value of one voxel (74 numbers). An example is presented below:
[22 29 21 7 19 12 23 25 33 28 25 5 21 18 27 21 11 11 26 12 12 31 15 15 12 29 17 34 30 11 12 24 35 28 27 26 29 22 15 23 24 14 14 37 241 313 350 349 382 402 333 344 332 366 339 383 383 379 394 398 402 357 346 379 365 376 366 365 360 363 376 383 389 385]
Summary and question to you:
I have many training sets consisting of 74 values from the range [0; 511]. I have 3 groups of voxels, which have a characteristic feature - the brightness is changing in the similar way. What I want to obtain is a classificator, which after getting one voxel vector with 74 numbers, will assess if the voxel belongs to one of these 3 groups, or to none of them.
Question: how to start with LibSVM, any advices? From what I know now is that I should transform input values to be from the range [0; 1] or [-1; 1]. I have many training sets prepared belonging to one of these 3 groups. I will be grateful for any advice, as I'm a newbie and I just need some tips just to start.
You can train and use you model like this:
model=svmtrain(train_label,train_feature,'-c 1 -g 0.07 -h 0');
% the parameters can be modified
[label, accuracy, probablity]=svmpredict(test_label,test_feaure,model);
train_label must be a vector,if there are more than two kinds of input(0/1),it will be an nSVM automatically. If you have 3 classes, you can label them using {1,2,3}.Its length is equal to the number of samples.
The feature is not restricted. It can be what ever you want.
However, you'd better preprocess them to make the results better. For example, you can change range[0:511] to range[0:1] or minus the mean of the feature.
Notice that the testset data should be preprocessed in the same way.
Hope this will help you!

Breeze extract columns from DenseMatrix based on list

I just started working with Breeze in Scala and I am trying to figure out how to extract columns from a DenseMatrix where the column indexes that I want to extract are in a list. For example, if you want to extract column 1,3 and 6 from a numpy array myArrayin Python you can write
myArray[:,[1,3,6]]
In Breeze I have tried something similar
myArray(::,(1,3,6))
but it creates a syntax error. I have looked at the Breeze Linear Algebra Cheat Sheet and but I only see the functionality to extract individual columns or contiguous columns. Is there any way to directly specify the columns that I want to extract as in my example?
I had the same problem; the fix that I found was to import numerics as well as linalg from breeze:
import breeze.numerics._
It's mentioned at the top of the cheat sheet you found, but it's very easy to miss, especially if you've searched for a particular operation (what happened to me).
We assign a dense matrix "dm" with the following contents:
import breeze.linalg._
val dm = DenseMatrix((0,1,2,3,4,5,6,7),
(8,9,10,11,12,13,14,15),
(16,17,18,19,20,21,22,23),
(24,25,26,27,28,29,30,31))
dm
0 1 2 3 4 5 6 7
8 9 10 11 12 13 14 15
16 17 18 19 20 21 22 23
24 25 26 27 28 29 30 31
If we want to extract columns of a matrix (e.g. 1,3,6), we could extract a part of matrix with columns indexing
dm(::,IndexedSeq(1,3,6))
1 3 6
9 11 14
17 19 22
25 27 30
or rows indexing
dm(IndexedSeq(1,3),::)
8 9 10 11 12 13 14 15
24 25 26 27 28 29 30 31
Thank you. Please feel free to comment

Manual Wilcoxon Rank-Sum Test

My statistics professor wants us to perform a manual Wilcoxon Rank-Sum Test using Matlab. Unfortunately, I have no experience with Matlab whatsoever, and I have been discovering as I go along. In short, we are given a list of 24 paired observations:
33 53 54 84 69 34 60 34 50 56 64 50 76 47 58 63 55 66 58 43 28 80 45
55
66 62 54 58 60 74 54 68 64 60 53 59 61 49 63 55 61 64 54 59 64 46 70
82
I've gotten to the point where I have a matrix with the absolute differences in the first column, the sign of the difference (indicated by a 1 for positive and -1 for negative) in the second column and the rank of the difference (1 through 24) in the third column.
I am struggling with finding a quick and efficient way to "break the ties" between the differences of equal size and allocating the average rank to each of these differences. I expect that some loops and logical statements may be required, but I am having a hard time with them as I have no prior experience.
Any suggestions on how to do this would be much appreciated.
One way to average over the ranks for entries with matching differences is as follows:
irankavg=zeros(length(dp),1);
[dpu,ix,iclass]=unique(dp);
for ii=1:length(dpu)
irankavg(iclass(ii)==iclass) = mean(irank(iclass(ii)==iclass));
end
where dp is a column array that contains the differences