Double scale for CSV data in gnuplot - csv

I would like to plot CSV data, and refer them with two x-axes. On the bottom linear (4*$1^2) scale, and on the top - logarithmic scale in other units ($1). Both scales should refer to the same plot.
plot "sum_no_realloc.csv" using ($1*$1*4):4 with lines,
So the bottom scale should be in 4*$1^2 units, and the top should be in $1 units.

Use the link command.
Suppose that your data file looks like this:
3 1
4 2
10 3
20 4
and you want to plot as you described. The x2 axis needs to show the x-coordinates and the x1 axis needs to show the transformed coordinates.
Issue the following commands:
set link x2 via sqrt(x/4.0) inverse 4.0*x*x
set x2tics
Then if you plot by
plot "datafile.txt" using ($1*$1*4.0):2 with lines
You will see that the x2 axis runs from 0 to 20 and the x1 axis runs from 0 to 1600 (4*20*20). The link command forces the two axes to be linked based on a mapping function. You need to specify how the x2 axis is determined from the x1 axis and how to go the other way around as well - gnuplot will usually throw a warning message when you do this about not being able to confirm the mapping.
The following plot shows the results (I labeled the axes using the normal set xlab and set x2lab commands).

Related

How to crop features outside an image region using pytorch?

We can use ROI-Pool/ROI-Align to crop the sub-features inside an image region (which is a rectangle).
I was wondering how to crop features outside this region.
In other words, how to set values (of a feature map) inside a rectangle region to zero, but values outside the region remains unchanged.
I'm not sure that this idea of ROI align is quite correct. ROI pool and align are used to take a number of differently sized regions of interest identified in the original input space (i.e. pixel-space) and output a set of same-sized feature crops from the features calculated by (nominally) the convolutional network.
As perhaps a simple answer to your question, though, you simply need to create a mask tensor of ones with the same dimension as your feature maps, and set the values within the ROIs to zero for this mask, then multiply the mask by the feature maps. This will suppress all values within the ROIs. Creation of this mask should be fairly simple. I did it with a for-loop to avoid thinking but there's likely more efficient ways as well.
feature_maps # batch_size x num_feature maps x width x height
mask = torch.ones(torch.shape(feature_maps[0,0,:,:]))
for ROI in ROIs: # assuming each ROI is [xmin ymin xmax ymax]
mask[ROI[0]:ROI[2],ROI[1]:ROI[3]] = 0
mask = mask.unsqueeze(0).unsqueeze(0) # 1 x 1 x width x height
mask = mask.repeat(batch_size,num_feature_maps,1,1) # batch_size x num_feature maps x width x height
output = torch.mul(mask,feature_maps)

How does the training data look like in Yolo model

I'm trying to figure out how to create YOLOv1 model from scratch but I can't figure out how the training data should look like. I suspect training labels (ground truth) looks like a matrix with (7, 7, 5*2 + 10) where
7x7 stands for the prediction grid
5 is object location and confidence (always equal to 1); x,y - known box center; h,v - box height and width
*2 is because there should be horizontal and vertical box for each cell
10 - is one-hot encoding for a class present in this position
what I don't understand is
whether to put confidence==1 to both horizontal and vertical bounding boxes?
whether x and y should be coordinates in the original (resized for the input) image?
...or maybe I'm completely off with my whole understanding. Does somebody have experience with YOLO?

Large ratio values ssrs chart

I have a bar chart that show the count of number of models for each agency,
The problem is that I have a large difference between the values that makes the report to look not so good.
Does anyone have any ideas of a good way to resolve this problem?
Have you considered using a logarithmic scale?
With your chart Right-click the y-axis, and click Vertical Axis Properties.
In Axis Options, select Use logarithmic scale.
Leave the Log base text box as 10 (this is the scale most commonly used by logarithmic charts)
This will display a chart with a scale that goes up by a factor of 10 for each ‘unit’ up, so the distance between 1 and 10 is the same as that between 100 and 1000.
For example the shown dataset is displayed as this chart when using the logarithmic scale
This method is a simple and recognised way to clearly show values of widely different scales.
Update
If want an indicative bar for the vales that are 1 then you could use the expression
=iif(Fields!val.Value = 1, Fields!val.Value * 1.1, Fields!val.Value)
To make all values that are 1 equal to 1.1 so showing a tiny bar appearing a the bottom of the chart, as seen here
Unfortunately I don't know of a way to change that first 1 to a zero (formatting-wise). This is partly because you are now using a logarithmic scale and zero and negative values don't really exist. This is due to a fundamental property of logarithms in mathematics, that
LOG10(10)= 1
LOG10(1) = 0
LOG10(.1)=-1
Therefore, when you perform a log10 of zero, it just doesn't exist.

Individual Y axis domain in multiple charts in D3

I will create multiple charts from one CSV-file using D3. I want the the Y axis du update in each chart. Now the y axis is the same for all charts. It is set by the maximum value in the whole number1 column, and not for each chart created with d3.nest.
How can i make the Y axis fit to the number1 data in each chart?
What is wrong with the code? JSbin
This is my CSV-data:
name,year,number1,number2,number3
Superman,2003,227141296,214978953,212418250 <-- number1 should be max for Superman chart
Superman,2004,232769230,220606887,211301729
Superman,2005,192769230,220606887,211301729
Batman,2003,252873171,239836381,225174161 <-- number1 should be max for Batman chart
Batman,2004,286137492,262439880,243001175
Batman,2004,232769230,220606887,211301729
Spiderman,2006,809584667,279490239,248758932 <-- number1 is now max in every chart
Spiderman,2007,324081833,278022620,246734614
Spiderman,2008,294081833,278022620,246734614
I've bumped your bin to here. Essentially, I added three divs and svgs using the d3.selectAll.data(heroes).enter();pattern. I then used the forEach to add in the axis's and line to each div / svg by passing in each element of the array in the object you created. Note that for some reason, jsbin isn't appending the first of the svg elements.
The maxNumber values was then passed to the y-axis constructor inside the foreach loop as were the year / number1 (x/y) values. The x/y values were passed to a single line generator, instead of the three separate line functions, making things a bit tidier.
Anyhow, hope this helps.

SSRS chart does not show y-axis data labels when values are very small (<1)

I have chart that plots values of Y-axis less than 1 (0.1, 0.24, etc).
When the chart is built, Y-axis label just shows 0 at the origin and no other values along the axis.
My solution was a little ugly. Data series labels show up with the correct % signs, but the % signs do not show up on the Y axis.
Y axis: set Y axis range from 1-100 (or 1-120 so there is room to display the data labels that say 100%) Make sure you set your tick marks to Auto or a number between 1 and 100, otherwise you'll get one long bar of tick marks running all the way up the y axis.
Data series: on the series tab, change your Value Field formula to multiply your data series by 100.
Data series labels: on the series data label properties window > general tab, copy the formula from your data series Value Field into the Label Data value field. round it to 0 decimal points and add &"%" to the end to concatenate a percent to the end of it.
That way the right numbers display for my data series and my Y axis, but the % just doesn't show up on the Y axis. not perfect yet. and too much work.
I just tested this and it seems this happens in SSRS 2005 and not 2008. You can fix this by right clicking on your chart and going to properties. It should bring up the full Chart Properties, go to the Y Axis tab and set Major Gridlines at a value like .25/.5 or whatever you want.