cntk.io.ImageDeserializer with two labels - cntk

I have a map file which contains image path and two labels per image:
imgage_path label1 label2
Is there a way to create a cntk.io.ImageDeserializer and a MinibatchSource of it?

Related

How can I plot something above a negative stacked bar chart using Matplotlib Python?

wish you a good day ! I must plot something like that using matplotlib : enter image description here
The standard ax.bar() function does not easily plot stacked bar charts with negative values, that's why I used dataframe.plot(stacked = True) to plot this bar. The problem is that I need to plot a line plot above this bar chart. This line should use the second vertical axis, so I need to get the current matplotlib axis object used by my dataframe.plot(stacked = True) function, I need to twinx() it and then plot the line on the twined axis.
However these 3 things do not work :
enter image description here
which gives :
enter image description here
enter image description here
which gives :
enter image description here
and
enter image description here
which gives :
enter image description here
I dont know what is going wrong, I know the problem stems from the dataframe.plot(stacked = True) function which is the only one that stacks easily bar charts with negative values.

gnuplot: Create multiple boxplots from different data files on the same output

I have a set of files that contain data that I want to produce a set of box plots for in order to compare them. I can get the data into gnuplot, but I don't know the correct format to separate each file into its own plot.
I have tried reading all the required files into a variable, which does work, however when the plot is produced, all the boxplots are on top of each other. I need to get gnuplot to index each plot along one space for each new data file.
For example, this produces the output with overlaying plots:
FILES = system("ls -1 /path/to/files/*")
plot for [data in FILES] data using (1):($4) with boxplot notitle
I know the X position is being stated explicitly there with the (1), but I'm not sure what to replace it with to get the position to move for each plot. This isn't a problem with other chart types, since they don't have the same field locating them.
You can try the following.
You can access the file in your file list by index via word(FILES,i). Check help word and help words. The code below assumes that you have some datafiles Data0*.dat in your directory. Maybe there is a smarter/shorter way to implement the xtic labels.
Code:
### boxplots from a list of files
reset session
# get a list of files (Windows)
FILES = system('dir /B "C:\Data\Data0*.dat"')
# set tics as filenames
set xtics () # remove xtics
set yrange [-2:27]
do for [i=1:words(FILES)] {
set xtics add (word(FILES,i) i) rotate by 45 right
}
plot for [i=1:words(FILES)] word(FILES,i) u (i):2 w boxplot notitle
### end of code
Result:

Matplotlib: How to use one multiple mathtext fonts in one figure?

In Matplotlib 2, using rcParams, I can set mathtext.fontset="cm" or mathtext.fontset="dejavusans" to control the font used in math-mode text in my figure. Is there a way so that within a single figure, I draw one text with one fontset, then a different text with a different fontset?

seaborn how do i create a box plot of only particular attributes in a dataframe

I would like to create two boxplots to visualize different attributes within my data by splitting the attributes up based on their scale. I currently have this
box plots to show the distributions of attributes
sns.boxplot(data=df)
box plot with all attributes included
I would like it to be like the images below with the attributes in different box plots based on their scale but with the attribute labels below each boxplot (not the current integers).
box plots to show the distributions of attributes
sns.boxplot(data=[df['mi'],df['steps'],df['Standing time'],df['lying time']])
box plot by scale 1
You can subset a pandas DataFrame by indexing with a list of column names
sns.boxplot(data=df[['mi', 'steps', 'Standing time', 'lying time']])

How do I update the legend label spacing after legend font size is changed in matplotlib?

I'm writing a script that saves a figure with multiple formatting styles among which is the font size of legend text.
The legend.labelspacing in rcparams or the matplotlibrc file specifies the label spacing in fractions of the font size, so I might expect the actual spacing to change if the font size is changed. However, since the actual spacing is probably calculated when the legend is first created, any subsequent change to the font size of existing legend text objects has no effect on the label spacing. Is there a way to update the legend label spacing after an existing legend label object's font size has been changed? In summary here's is what I would like to do:
plot something with a legend
save the figure (format according to rcparams or matplotlibrc file)
change several formatting properties (line widths, font sizes, etc.)
save the figure again with the updated formatting properties, including re-adjusted legend label spacing
Is there a way to do this without changing the rcparams and then rebuilding the figure?
Just call legend() with labelspacing parameter, here is an example:
import pylab as pl
pl.plot([0,1],[0,1], label="a")
pl.plot([0,2],[0,2], label="b")
pl.legend()
pl.savefig("p1.png")
pl.legend(labelspacing=2)
pl.savefig("p2.png")
To reuse parameters:
import pylab as pl
pl.plot([0,1],[0,1], label="a")
pl.plot([0,2],[0,2], label="b")
params = dict(loc="right", prop=dict(size=9))
pl.legend(**params)
pl.savefig("p1.png")
params["labelspacing"] = 2
pl.legend(**params)
pl.savefig("p2.png")