Tools

draw_gridscores

pymks.tools.draw_gridscores(grid_scores, param, score_label=None, colors=None, data_labels=None, param_label=None, fontsize=20)

Visualize the score values and standard deviations from grids scores result from GridSearchCV while varying 1 parameters.

Parameters:
  • grid_scores (list, grid_scores) – grid_scores_ attribute from GridSearchCV
  • param (list, str) – parameters used in grid_scores
  • score_label (str) – label for score value axis
  • colors (list) – colors used for this specified parameter
  • param_label (list) – parameter titles to appear on plot

draw_gridscores_matrix

pymks.tools.draw_gridscores_matrix(grid_scores, params, score_label=None, param_labels=None)

Visualize the score value matrix and standard deviation matrix from grids scores result from GridSearchCV while varying two parameters.

Parameters:
  • grid_scores (list) – grid_scores_ attribute from GridSearchCV
  • params (list) – two parameters used in grid_scores
  • score_label (str) – label for score value axis
  • param_labels (list) – parameter titles to appear on plot

draw_components

pymks.tools.draw_components(X_comp, fontsize=15, figsize=None)

Visualize spatial correlations.

Parameters:
  • X_corr (ND array) – correlations
  • correlations (list, optional) – correlation labels

draw_component_variance

pymks.tools.draw_component_variance(variance)

Visualize the percent variance as a function of components.

Parameters:variance (list) – variance ratio explanation from dimensional reduction technique.

draw_goodness_of_fit

pymks.tools.draw_goodness_of_fit(fit_data, pred_data, labels)

Goodness of fit plot for MKSHomogenizationModel.

Parameters:
  • fit_data (2D array) – Low dimensional representation of the prediction values of the data used to fit the model and the actual values.
  • pred_data (2D array) – Low dimensional representation of the prediction values of the data used for prediction with the model and the actual values.

draw_correlations

pymks.tools.draw_correlations(X_corr, correlations=None)

Visualize spatial correlations.

Parameters:
  • X_corr (ND array) – correlations
  • correlations (list, optional) – correlation labels

draw_autocorrelations

pymks.tools.draw_autocorrelations(X_auto, autocorrelations=None)

Visualize spatial autocorrelations.

Parameters:
  • X_auto (ND array) – autocorrelations
  • autocorrelations (list, optional) – autocorrelation labels.

draw_crosscorrelations

pymks.tools.draw_crosscorrelations(X_cross, crosscorrelations=None)

Visualize spatial crosscorrelations.

Parameters:
  • X_cross (ND array) – cross-correlations
  • correlations (list, optional) – cross-correlation labels.

draw_learning_curves

pymks.tools.draw_learning_curves(estimator, X, y, ylim=None, cv=None, n_jobs=1, scoring=None, train_sizes=array([ 0.1, 0.325, 0.55, 0.775, 1. ]))

Code taken from scikit-learn examples for version 0.15.

Generate a simple plot of the test and traning learning curve.

Parameters:
  • estimator (class) – object type that implements the “fit” and “predict” methods An object of that type which is cloned for each validation.
  • title (str) – Used for the title for the chart.
  • X (2D array) – array-like, shape (n_samples, n_features) Training vector, where n_samples is the number of samples and n_features is the number of features.
  • y (1D array) – array-like, shape (n_samples) or (n_samples, n_features), optional Target relative to X for classification or regression; None for unsupervised learning.
  • ylim (tuple, optional) – Defines minimum and maximum yvalues plotted.
  • cv (int, optional) – If an integer is passed, it is the number of folds (defaults to 3). Specific cross-validation objects can be passed, see sklearn.cross_validation module for the list of possible objects
  • n_jobs (int, optional) – Number of jobs to run in parallel (default 1).
  • train_sizes (float) – Relative or absolute numbers of training examples that will be used to generate the learning curve. If the dtype is float, it is regarded as a fraction of the maximum size of the training set (that is determined by the selected validation method), i.e. it has to be within (0, 1]. Otherwise it is interpreted as absolute sizes of the training sets. Note that for classification the number of samples usually have to be big enough to contain at least one sample from each class. (default: np.linspace(0.1, 1.0, 5))
  • Returns – A plot of the learning curves for both the training curve and the cross-validation curve.

draw_coeff

pymks.tools.draw_coeff(coeff, fontsize=15, figsize=None)

Visualize influence coefficients.

Parameters:
  • coeff (ND array) – influence coefficients with dimensions (x, y, n_states)
  • fontsize (int, optional) – values used for the title font size

draw_microstructures

pymks.tools.draw_microstructures(microstructures, labels=None, figsize=None)

Draw microstructures

Parameters:
  • microstructures (3D array) – numpy array with dimensions (n_samples, x, y)
  • labels (list, str, optional) – titles for strain fields
  • figsize (tuple, optional) – specifies the number of images in each direction.

draw_microstructure_strain

pymks.tools.draw_microstructure_strain(microstructure, strain)

Draw microstructure and its associated strain

Parameters:
  • microstructure (2D array) – numpy array with dimensions (x, y)
  • strain (2D array) – numpy array with dimensions (x, y)

draw_strains

pymks.tools.draw_strains(strains, labels=None, fontsize=15)

Draw strain fields

Parameters:
  • strains (3D array) – numpy arrays with dimensions (n_samples, x, y)
  • labels (list, str, optional) – titles for strain fields
  • fontsize (int, optional) – title font size

draw_strains_compare

pymks.tools.draw_strains_compare(strain_FEM, strain_MKS, fontsize=20)

Draw comparison of strain fields.

Parameters:
  • strain_FEM (2D array) – strain field with dimensions (x, y) from finite element
  • strain_MKS (2D array) – strain fieldwith dimensions (x, y) from MKS
  • fontsize (int, optional) – scalar values used for the title font size

draw_concentrations

pymks.tools.draw_concentrations(concentrations, labels=None, fontsize=15)

Draw comparison fields

Parameters:
  • concentrations (list) – numpy arrays with dimensions (x, y)
  • labels (list) – titles for concentrations
  • fontsize (int) – used for the title font size

draw_concentrations_compare

pymks.tools.draw_concentrations_compare(concentrations, labels, fontsize=15)

Draw comparesion of concentrations.

Parameters:
  • concentrations (3D array) – list of difference arrays with dimensions (x, y)
  • labels (list, str) – list of titles for difference arrays
  • fontsize (int, optional) – scalar values used for the title font size

draw_differences

pymks.tools.draw_differences(differences, labels=None, fontsize=15)

Draw differences in predicted response fields.

Parameters:
  • differences (list, 2D arrays) – list of difference arrays with dimesions (x, y).
  • labels (list, str, optional) – titles for difference arrays
  • fontsize (int, optional) – scalar values used for the title font size