<commit_before>"""Matrix factorization with Sparse PCA"""
# Author: <NAME>, <NAME>, <NAME>
# License: BSD

import time
import sys

from math import sqrt, floor, ceil
import itertools

import numpy as np
from numpy.lib.stride_tricks import as_strided
from scipy import linalg

from ..utils import check_random_state
from ..utils import gen_even_slices
from ..utils.extmath import fast_svd
from ..linear_model import Lasso, lars_path, ridge_regression
from ..externals.joblib import Parallel, delayed, cpu_count
from ..base import BaseEstimator, TransformerMixin
from ..utils.extmath import fast_svd


def _update_code(dictionary, Y, alpha, code=None, Gram=None, method='lars',
                 tol=1e-8):
    """Update the sparse code factor in the sparse_pca loop.

    Each column of the result is the solution to a Lasso problem.<commit_msg>duplicated import<commit_after>"""Matrix factorization with Sparse PCA"""
# Author: <NAME>, <NAME>, <NAME>
# License: BSD

import time
import sys

from math import sqrt, floor, ceil
import itertools

import numpy as np
from numpy.lib.stride_tricks import as_strided
from scipy import linalg

from ..utils import check_random_state
from ..utils import gen_even_slices
from ..utils.extmath import fast_svd
from ..linear_model import Lasso, lars_path, ridge_regression
from ..externals.joblib import Parallel, delayed, cpu_count
from ..base import BaseEstimator, TransformerMixin


def _update_code(dictionary, Y, alpha, code=None, Gram=None, method='lars',
                 tol=1e-8):
    """Update the sparse code factor in the sparse_pca loop.

    Each column of the result is the solution to a Lasso problem.
{'fraction_non_alphanumeric': 0.08045977011494253, 'fraction_numerical': 0.0024198427102238356, 'mean_word_length': 4.531772575250836, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6707588', 'n_tokens_mistral': 514, 'n_tokens_neox': 489, 'n_words': 190}