LiNA

class lingam.LiNA(w_threshold=0.3, lambda1=0.1, lambda2=0.1, loss_type='laplace', max_iter=100, h_tol=1e-08, rho_max=1e+16)[source]

Implementation of LiNA Algorithm [1]

References

__init__(w_threshold=0.3, lambda1=0.1, lambda2=0.1, loss_type='laplace', max_iter=100, h_tol=1e-08, rho_max=1e+16)[source]

Construct a LiNA model.

Parameters:
  • w_threshold (float (default=0.3)) – Drop edge if the weight btw. latent factors is less than w_threshold.

  • lambda1 (float, optional (default=0.1)) – L1 penalty parameter.

  • lambda2 (float, (default=0.1)) – L2 penalty parameter.

  • loss_type (str, (default='laplace')) – Type of distribution of the noise.

  • max_iter (int, (default=100)) – Maximum number of dual ascent steps.

  • h_tol (float, (default=1e-8)) – Tolerance parameter of the acyclicity constraint.

  • rho_max (float, (default=1e+16)) – Maximum value of the regularization parameter rho.

property adjacency_matrix_

Estimated adjacency matrix between latent factors.

Returns:

adjacency_matrix_ – The adjacency matrix of latent factors, where n_features_latent is the number of latent factors.

Return type:

array-like, shape (n_features_latent, n_features_latent)

fit(X, G_sign, scale)[source]

Fit the model to X with measurement structure and latent factors’ scales.

Parameters:
  • X (array-like, shape (n_samples, n_features)) – Training data, where n_samples is the number of samples and n_features is the number of measurement features.

  • G_sign (array-like, shape (n_features, n_features_latent)) – Measurement structure matrix, where n_features_latent is the number of latent factors and n_features is the number of measurement features.

  • scale (array-like, shape (1, n_features_latent)) – Scales of the latent factors.

Returns:

self – Returns the instance of self.

Return type:

object

property measurement_matrix_

Estimated measurement matrix between measurement variables and latent factors.

Returns:

measurement_matrix_ – The measurement matrix between measurement variables and latent factors, where n_features_latent is the number of latent factors and n_features is the number of measurement variables.

Return type:

array-like, shape (n_features, n_features_latent)

class lingam.MDLiNA(w_threshold=0.3, lambda1=0.1, lambda2=0.1, loss_type='laplace', max_iter=100, h_tol=1e-08, rho_max=1e+16, no_of_domain=2, no_of_latent_1domain=3)[source]

Implementation of MD-LiNA Algorithm [2]

References

__init__(w_threshold=0.3, lambda1=0.1, lambda2=0.1, loss_type='laplace', max_iter=100, h_tol=1e-08, rho_max=1e+16, no_of_domain=2, no_of_latent_1domain=3)[source]

Construct an MD-LiNA model.

Parameters:
  • w_threshold (float (default=0.3)) – Drop edge if the weight btw. latent factors is less than w_threshold.

  • lambda1 (float, optional (default=0.1)) – L1 penalty parameter.

  • lambda2 (float, (default=0.1)) – L2 penalty parameter.

  • loss_type (str, (default='laplace')) – Type of distribution of the noise.

  • max_iter (int, (default=100)) – Maximum number of dual ascent steps.

  • h_tol (float, (default=1e-8)) – Tolerance parameter of the acyclicity constraint.

  • rho_max (float, (default=1e+16)) – Maximum value of the regularization parameter rho.

  • no_of_domain (int, (default=2)) – Number of domains.

  • no_of_latent_1domain (float, (default=3)) – Number of latent factors in a domain.

property adjacency_matrix_

Estimated adjacency matrix between latent factors of interest, which is shared by all domains.

Returns:

adjacency_matrix_ – The adjacency matrix of latent factors of interest, where n_features_latent_1domain is the number of latent factors of interest.

Return type:

array-like, shape (n_features_latent_1domain, n_features_latent_1domain)

fit(X, G_sign, scale)[source]

Fit the model to X with measurement structure and latent factors’ scales.

Parameters:
  • X (array-like, shape (n_samples, n_features)) – Training data, where n_samples is the number of samples of all domains and n_features is the number of features of all domains.

  • G_sign (array-like, shape (n_features, n_features_latent)) – Measurement structure matrix, where n_features_latent is the number of latent factors of all domains and n_features is the number of measurement variables of all domains.

  • scale (array-like, shape (1, n_features_latent)) – Scales of the latent factors.

Returns:

self – Returns the instance of self.

Return type:

object

property measurement_matrix_

Estimated measurement matrix between measurement variables and latent factors from all domains.

Returns:

measurement_matrix_ – The measurement matrix between measurement variables and latent factors, where n_features_latent is the number of latent factors and n_features is the number of measurement variables from all domains.

Return type:

array-like, shape (n_features, n_features_latent)