pymks/mks_homogenization_model.py
def _correlate(self, X, periodic_axes, confidence_index):
        """
        Helper function used to calculated 2-point statistics from `X` and
        reshape them appropriately for fit and predict methods.

        Args:
            X (ND array): The microstructure, an `(n_samples, n_x, ...)`
                shaped array where `n_samples` is the number of samples and
                `n_x` is the spatial discretization..
            periodic_axes (list, optional): axes that are periodic. (0, 2)
                would indicate that axes x and z are periodic in a 3D
                microstrucure.
            confidence_index (ND array, optional): array with same shape as X
                used to assign a confidence value for each data point.

        Returns:
            Spatial correlations for each sample formated with dimensions
            (n_samples, n_features).

        Example

        >>> from sklearn.manifold import Isomap
        >>> from sklearn.linear_model import ARDRegression
        >>> from pymks.bases import PrimitiveBasis
        >>> reducer = Isomap()
        >>> linker = ARDRegression()
        >>> prim_basis = PrimitiveBasis(2, [0, 1])
        >>> model = MKSHomogenizationModel(prim_basis, reducer, linker)
        >>> X = np.array([[0, 1],
        ...               [1, 0]])
        >>> X_stats = model._correlate(X, [], None)
        >>> X_test = np.array([[[ 0, 0],
        ...                     [0.5, 0]],
        ...                    [[0, 1,],
        ...                     [0.5, 0]]])
        >>> assert np.allclose(X_test, X_stats)
        """
        if self.basis is None:
            raise AttributeError('basis must be specified')
        X_ = self.basis.discretize(X)
        X_stats = correlate(X_, periodic_axes=periodic_axes,
                            confidence_index=confidence_index,
                            correlations=self.correlations)
        return X_stats

        Helper function used to calculated 2-point statistics from `X` and
        reshape them appropriately for fit and predict methods.

        Args:
            X (ND array): The microstructure, an `(n_samples, n_x, ...)`
                shaped array where `n_samples` is the number of samples and
                `n_x` is the spatial discretization..
            periodic_axes (list, optional): axes that are periodic. (0, 2)
                would indicate that axes x and z are periodic in a 3D
                microstrucure.
            confidence_index (ND array, optional): array with same shape as X
                used to assign a confidence value for each data point.

        Returns:
            Spatial correlations for each sample formated with dimensions
            (n_samples, n_features).

        Example

        >>> from sklearn.manifold import Isomap
        >>> from sklearn.linear_model import ARDRegression
        >>> from pymks.bases import PrimitiveBasis
        >>> reducer = Isomap()
        >>> linker = ARDRegression()
        >>> prim_basis = PrimitiveBasis(2, [0, 1])
        >>> model = MKSHomogenizationModel(prim_basis, reducer, linker)
        >>> X = np.array([[0, 1],
        ...               [1, 0]])
        >>> X_stats = model._correlate(X, [], None)
        >>> X_test = np.array([[[ 0, 0],
        ...                     [0.5, 0]],
        ...                    [[0, 1,],
        ...                     [0.5, 0]]])
        >>> assert np.allclose(X_test, X_stats)
        
Helper function used to calculated 2-point statistics from `X` and
reshape them appropriately for fit and predict methods.
Helper function used to calculated 2 - point statistics from ` X ` and reshape them appropriately for fit and predict methods .
def _correlate(self, X, periodic_axes, confidence_index):
        if self.basis is None:
            raise AttributeError('basis must be specified')
        X_ = self.basis.discretize(X)
        X_stats = correlate(X_, periodic_axes=periodic_axes,
                            confidence_index=confidence_index,
                            correlations=self.correlations)
        return X_stats
def _correlate ( self , X , periodic_axes , confidence_index ) : if self . basis is None : raise AttributeError ( 'basis must be specified' ) X_ = self . basis . discretize ( X ) X_stats = correlate ( X_ , periodic_axes = periodic_axes , confidence_index = confidence_index , correlations = self . correlations ) return X_stats
Helper function used to calculated 2-point statistics from `X` and
reshape them appropriately for fit and predict methods.
Helper function used to calculated 2 - point statistics from ` X ` and reshape them appropriately for fit and predict methods .
"""
        Helper function used to calculated 2-point statistics from `X` and
        reshape them appropriately for fit and predict methods.

        Args:
            X (ND array): The microstructure, an `(n_samples, n_x, ...)`
                shaped array where `n_samples` is the number of samples and
                `n_x` is the spatial discretization..
            periodic_axes (list, optional): axes that are periodic. (0, 2)
                would indicate that axes x and z are periodic in a 3D
                microstrucure.
            confidence_index (ND array, optional): array with same shape as X
                used to assign a confidence value for each data point.

        Returns:
            Spatial correlations for each sample formated with dimensions
            (n_samples, n_features).

        Example

        >>> from sklearn.manifold import Isomap
        >>> from sklearn.linear_model import ARDRegression
        >>> from pymks.bases import PrimitiveBasis
        >>> reducer = Isomap()
        >>> linker = ARDRegression()
        >>> prim_basis = PrimitiveBasis(2, [0, 1])
        >>> model = MKSHomogenizationModel(prim_basis, reducer, linker)
        >>> X = np.array([[0, 1],
        ...               [1, 0]])
        >>> X_stats = model._correlate(X, [], None)
        >>> X_test = np.array([[[ 0, 0],
        ...                     [0.5, 0]],
        ...                    [[0, 1,],
        ...                     [0.5, 0]]])
        >>> assert np.allclose(X_test, X_stats)
        """
Spatial correlations for each sample formated with dimensions
(n_samples, n_features).
Spatial correlations for each sample formated with dimensions ( n_samples n_features ) .
self
X
The microstructure, an `(n_samples, n_x, ...)`
shaped array where `n_samples` is the number of samples and
`n_x` is the spatial discretization
The microstructure an ` ( n_samples n_x ... ) ` shaped array where ` n_samples ` is the number of samples and ` n_x ` is the spatial discretization
periodic_axes
axes that are periodic. (0, 2)
would indicate that axes x and z are periodic in a 3D
microstrucure.
axes that are periodic . ( 0 2 ) would indicate that axes x and z are periodic in a 3D microstrucure .
confidence_index
array with same shape as X
used to assign a confidence value for each data point.
array with same shape as X used to assign a confidence value for each data point .