watex.view.plotProjection#
- watex.view.plotProjection(X, Xt=None, *, columns=None, test_kws=None, **baseplot_kws)[source]#
Visualize train and test dataset based on the geographical coordinates.
Since there is geographical information(latitude/longitude or easting/northing), it is a good idea to create a scatterplot of all instances to visualize data.
- Parameters
X (Ndarray ( M x N matrix where
M=m-samples, &N=n-features)) – training set; Denotes data that is observed at training and prediction time, used as independent variables in learning. The notation is uppercase to denote that it is ordinarily a matrix. When a matrix, each sample may be represented by a feature vector, or a vector of precomputed (dis)similarity with each training sample.Xt (Ndarray ( M x N matrix where
M=m-samples, &N=n-features)) – Shorthand for “test set”; data that is observed at testing and prediction time, used as independent variables in learning. The notation is uppercase to denote that it is ordinarily a matrix.columns (list of str or index, optional) – columns is usefull when a dataframe is given with a dimension size greater than 2. If such data is passed to X or Xt, columns must hold the name to considered as ‘easting’, ‘northing’ when UTM coordinates are given or ‘latitude’ , ‘longitude’ when latlon are given. If dimension size is greater than 2 and columns is None , an error will raises to prevent the user to provide the index for ‘y’ and ‘x’ coordinated retrieval.
test_kws (dict,) – keywords arguments passed to
matplotlib.plot.scatter()as test location font and colors properties.baseplot_kws (dict,) – All all the keywords arguments passed to the peroperty
watex.property.BasePlotclass.
Examples
>>> from watex.datasets import fetch_data >>> from watex.view.mlplot import plotProjection >>> # Discard all the non-numeric data >>> # then inut numerical data >>> from watex.utils import to_numeric_dtypes, naive_imputer >>> X, Xt, *_ = fetch_data ('bagoue', split_X_y =True, as_frame =True) >>> X =to_numeric_dtypes(X, pop_cat_features=True ) >>> X= naive_imputer(X) >>> Xt = to_numeric_dtypes(Xt, pop_cat_features=True ) >>> Xt= naive_imputer(Xt) >>> plot_kws = dict (fig_size=(8, 12), lc='k', marker='o', lw =3., font_size=15., xlabel= 'easting (m) ', ylabel='northing (m)' , markerfacecolor ='k', markeredgecolor='r', alpha =1., markeredgewidth=2., show_grid =True, galpha =0.2, glw=.5, rotate_xlabel =90., fs =3., s =None ) >>> plotProjection( X, Xt , columns= ['east', 'north'], trainlabel='train location', testlabel='test location', **plot_kws )