I have my data as a {instance, feature values} matrix. I want to visualize the correlation of features in Matlab.
Matlab comes with a handy function named corrplot. I get the correlation plot, but with features named as var1, var2, var3 etc., instead of the real feature labels. What is the method of specifying the feature labels to use when plotting the correlations?
I can't test the following since I don't have the Econometrics Toolbox, but according to the docs (and as in many, many, many MATLAB functions) you can provide Name-Value pair arguments to the function in order to set specific parameters.
In your case, you wish to use the varNames argument with an appropriate cell array of strings, here {'instance';'feature';'value'}, and that should do it.
Have fun!
Related
I have different matrices to import into a Simulink Matlab function from the workspace. These matrices have all different dimension, which I don´t know at priori.
At the beginning I tried using the block 'constant' putting the data all together in a structure like this:
But then, I cannot pick the right matrix since I don´t know the dimension of each element (and also 'mux' cannot be used to split matrices).
I think I will have the same problem also with the block 'from workspace'.
I was wondering if there is a smart way to import heterogeneous structures like these. I tried also with cell-arrays, but it seems to be not supported by Simulink.
Thanks for any suggestions.
If the data is to be used in a Matlab Function block you could define the workspace matricies as parameters in the model explorer and in the Matlab Function port editor. You then have them accessible inside that function without even needing the "const" blocks or drawing any signals.
Even if your final intent is not to have data into a Matlab Function block those blocks are quite useful for extracting signals from heterogeneous data since you can do some size/type checking in them. Then you can output "simulink friendly" signals for use elsewhere.
I am new in learning matlab. when I am using the solve() function, matlab warning me that i must use a symbolic variable before using the solve function. but I actually don't know what the sym variable is. or What is the difference between the symbolic variables and the ordinary variables of the base workspace?
Symbolic variables are useful to express equations and manipulate them in an analytic manner. You can use them to manipulte them algebrically, without the need of actually associating any type of numbers.
Suppose you want the exact analytical form of a solution for an equation, in terms of symbols that express this function. Then you can use a sym variable to express and operate with the unkwons, rather than to use on numerical methods to find solutions
Symbolic variables are also useful to operate with tranfer funcions and perform simplications that are very tedious If done without a computer program.
You also can associate numbers with sym variables, once you have done all the all the intended operations.
If you don't want perform operations with algebraic variables, you should checkout the fsolve function
I am plotting a data set consisting of the same kind of data from nominally the same source. I am using MATLAB's probplot command. I would like to do something along the lines of using findgroups to plot the points with a color corresponding to their source. I have attempted, for example,
probplot('lognormal', data, ~findgroups(category))
I am not sure how (or if) one could use the 'params' functionality to pass the findgroups and make this work. I'm interested in any other solutions as well.
I'm trying to perform logistic regression to do classification using MATLAB. There seem to be two different methods in MATLAB's statistics toolbox to build a generalized linear model 'glmfit' and 'fitglm'. I can't figure out what the difference is between the two. Is one preferable over the other?
Here are the links for the function descriptions.
http://uk.mathworks.com/help/stats/glmfit.html
http://uk.mathworks.com/help/stats/fitglm.html
The difference is what the functions output. glmfit just outputs a vector of the regression coefficients (and some other stuff if you ask for it). fitglm outputs a regression object that packs all sorts of information and functionality inside (See the docs on GeneralizedLinearModel class). I would assume the fitglm is intended to replace glmfit.
In addition to Dan's answer, I would like to add the following.
The function fitglm, like newer functions from the statistics toolbox, accepts more flexible inputs than glmfit. For example, you can use a table as the data source, specifyy a formula of the form Y ~ X1 + X2 + ..., and use categorical variables.
As a side note, the function lassoglm uses (depends on) glmfit.
Background Information
I'm trying to apply Bag of Words on SURF/BRISK features as an experiment on the Cats/Dogs dataset. I've extracted all the features into a vector.
Issue:
When I feed the vectors into kmeans(points, numPts*0.04) it says that:
Undefined function 'isnan' for input arguments of type 'BRISKPoints'
The problem here is that BRISKPoints is a MATLAB object, not a numeric matrix. You cannot do k-means on it directly. What should go into k-means is the output of extractFeatures. Note that extractFeatures can return either SURF or FREAK descriptors depending on the type of the input points or the value of the 'Method' parameter. You can use k-means to cluster SURF descriptors, which are simply numerical vectors, but not FREAK descriptors, which are strings of bits encapsulated in a binaryFeatures object.
By the way, as of R2014b there is built-in support for the bag of words image classification in the Computer Vision System Toolbox. Please see this example.