Skip to main content

learner-py

The learner-py package implements transfer learning methods for low-rank matrix estimation. These methods leverage similarity in the latent row and column spaces between the source and target populations to improve estimation in the target population. The methods include the LatEnt spAce-based tRaNsfer lEaRning (LEARNER) method and the direct projection LEARNER (D-LEARNER) method described by McGrath et al. (2024).

Installation

You can install the released version of learner-py from PyPi with:

pip install learner-py

LEARNER Method

We can apply the LEARNER method via the learner function.

This method allows for flexible patterns of heterogeneity across the source and target populations. It consequently requires specifying the tuning parameters lambda_1 and lambda_2 which control the degree of transfer learning between the populations. These values can be selected based on cross-validation via the cv.learner function. For example, we can specify candidate values of 1, 10, and 100 for lambda_1 and lambda_2 and select the optimal values based on cross-validation as follows:

res_cv = pylearner.cv_learner(
            Y_source=dat_highsim["Y_source"],
            Y_target=dat_highsim["Y_target"],
            lambda1_all=[1, 10, 100],
            lambda2_all=[1, 10, 100],
            step_size=0.003
        )

print(res_cv['lambda_1_min']) #100
print(res_cv["lambda_2_min"]) #1

Example

We illustrate an example of how learner can be used. We first load the package.

import learner-py as pylearner

In this illustration, we will use one of the toy data sets in the package (dat_highsim) that has a high degree of similarity between the latent spaces of the source and target populations. The object dat_highsim is a list which contains the observed source population data matrix Y_source and the target population data matrix Y_target. Since the data was simulated, the true values of the matrices are included in dat_highsim as Theta_source and Theta_target.

LEARNER Method

We can apply the LEARNER method via the learner function.

This method allows for flexible patterns of heterogeneity across the source and target populations. It consequently requires specifying the tuning parameters lambda_1 and lambda_2 which control the degree of transfer learning between the populations. These values can be selected based on cross-validation via the cv.learner function. For example, we can specify candidate values of 1, 10, and 100 for lambda_1 and lambda_2 and select the optimal values based on cross-validation as follows:

res_cv = pylearner.cv_learner(
            Y_source=dat_highsim["Y_source"],
            Y_target=dat_highsim["Y_target"],
            lambda1_all=[1, 10, 100],
            lambda2_all=[1, 10, 100],
            step_size=0.003
        )

print(res_cv['lambda_1_min']) #100
print(res_cv["lambda_2_min"]) #1

Next, we apply the learner function with these values of lambda1 and lambda2:

res_learner <- learner(Y_source = dat_highsim$Y_source, 
                       Y_target = dat_highsim$Y_target,
                       lambda1 = 100, lambda2 = 1, 
                       step_size = 0.003)

The LEARNER estimate is given by the learner_estimate component in the output of the learner function, e.g.,

print(res_learner['learner_estimate'][0:4, 0:4])
[[ 0.14688887 -1.63414688  1.18573076  0.00809396]
 [ 0.10877659 -0.2439277  -1.0061737  -0.05811972]
 [-0.62130277  1.04206753 -0.69077759  0.90570933]
 [ 1.58115883 -3.0000149   0.39780804 -2.12428512]]

D-LEARNER Method

We can apply the D-LEARNER method via the dlearner function. This method makes stronger assumptions on the heterogeneity across the source and target populations. It consequently does not rely on choosing tuning parameters. The dlearner function can be applied as follows:

res_dlearner = pylearner.dlearner(Y_source=dat_highsim["Y_source"],
                                  Y_target=dat_highsim["Y_target"])

print(res_dlearner['dlearner_estimate'][0:4, 0:4])

[[ 0.0959171  -1.72143637  1.15500149  0.00547827]
 [ 0.10771367 -0.3224348  -1.03557177 -0.10819564]
 [-0.72372751  0.86634922 -0.43528206  1.10580219]
 [ 1.63476957 -2.91985925  0.04876288 -2.35750409]]

Metadata

Release files for learner-py 1.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distributions (wheels)

Table of built distributions (wheels) for learner-py 1.0.4
File
learner_py-1.0.4-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details
learner_py-1.0.4-cp313-cp313-macosx_10_13_x86_64.whl CPython 3.13 CPython 3.13 macOS 10.13+ x86-64 Details
learner_py-1.0.4-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details
learner_py-1.0.4-cp312-cp312-macosx_10_13_x86_64.whl CPython 3.12 CPython 3.12 macOS 10.13+ x86-64 Details
learner_py-1.0.4-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details
learner_py-1.0.4-cp311-cp311-musllinux_1_2_x86_64.whl CPython 3.11 CPython 3.11 Linux musl 1.2+ x86-64 Details
learner_py-1.0.4-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.24+ x86-64, Linux glibc 2.28+ x86-64 Details
learner_py-1.0.4-cp311-cp311-macosx_10_9_x86_64.whl CPython 3.11 CPython 3.11 macOS 10.9+ x86-64 Details
learner_py-1.0.4-cp310-cp310-win_amd64.whl CPython 3.10 CPython 3.10 Windows x86-64 Details
learner_py-1.0.4-cp310-cp310-musllinux_1_2_x86_64.whl CPython 3.10 CPython 3.10 Linux musl 1.2+ x86-64 Details
learner_py-1.0.4-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.28+ x86-64, Linux glibc 2.24+ x86-64 Details
learner_py-1.0.4-cp310-cp310-macosx_10_9_x86_64.whl CPython 3.10 CPython 3.10 macOS 10.9+ x86-64 Details
learner_py-1.0.4-cp39-cp39-win_amd64.whl CPython 3.9 CPython 3.9 Windows x86-64 Details
learner_py-1.0.4-cp39-cp39-musllinux_1_2_x86_64.whl CPython 3.9 CPython 3.9 Linux musl 1.2+ x86-64 Details
learner_py-1.0.4-cp39-cp39-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl CPython 3.9 CPython 3.9 Linux glibc 2.24+ x86-64, Linux glibc 2.28+ x86-64 Details
learner_py-1.0.4-cp39-cp39-macosx_10_9_x86_64.whl CPython 3.9 CPython 3.9 macOS 10.9+ x86-64 Details

Total release size: 68.1 MB

Release files / learner_py-1.0.4-cp313-cp313-win_amd64.whl

Download URL learner_py-1.0.4-cp313-cp313-win_amd64.whl
Size 237.9 kB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
33f4dc469bab8b34154209b6234598add766340cd8bb3f8c6fba129201f21638
BLAKE2b-256 checksum
How to use checksums
11fc2f8a79d11be38bc10ac9db62d45b2be4357280197e8da017106a9107d6fc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 7, 2025.

Transparency log

Release files / learner_py-1.0.4-cp313-cp313-macosx_10_13_x86_64.whl

Download URL learner_py-1.0.4-cp313-cp313-macosx_10_13_x86_64.whl
Size 346.9 kB
Tags CPython 3.13 macOS 10.13+ x86-64
SHA-256 checksum
How to use checksums
24bf1417bc02cf50c12439cc45855e88c15df9cbcac30891082230a0dff30475
BLAKE2b-256 checksum
How to use checksums
de2b85871c6cc9ecbc6c2ad9db504e4c77cc27450909b051201815c152e3e522
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 7, 2025.

Transparency log

Release files / learner_py-1.0.4-cp312-cp312-win_amd64.whl

Download URL learner_py-1.0.4-cp312-cp312-win_amd64.whl
Size 237.8 kB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
5462a8032b77d10e720e0952142fad0dce2e231d3aa15817237d255136fe813e
BLAKE2b-256 checksum
How to use checksums
6e453210d7df31388b3e0f533ec0eb3f25537c7fcf6d8d949b0bee464ee6f38d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 7, 2025.

Transparency log

Release files / learner_py-1.0.4-cp312-cp312-macosx_10_13_x86_64.whl

Download URL learner_py-1.0.4-cp312-cp312-macosx_10_13_x86_64.whl
Size 346.8 kB
Tags CPython 3.12 macOS 10.13+ x86-64
SHA-256 checksum
How to use checksums
70a007b4678feea30344b03d7d4e90d135334ae4901e4263c828942310faeeda
BLAKE2b-256 checksum
How to use checksums
41f0cc988b52f6704ab9808627c06ce9c6d213ccab92dd0c7b7bfc3a81759700
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 7, 2025.

Transparency log

Release files / learner_py-1.0.4-cp311-cp311-win_amd64.whl

Download URL learner_py-1.0.4-cp311-cp311-win_amd64.whl
Size 236.9 kB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
7283544a7387c41361234bca8c9aae3857f8ef046a20587a1f1715fe92f463f3
BLAKE2b-256 checksum
How to use checksums
f04d581038179282a864e59a62f25eed666cffee30c6f66bdaf825ad9c4b07ba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 7, 2025.

Transparency log

Release files / learner_py-1.0.4-cp311-cp311-musllinux_1_2_x86_64.whl

Download URL learner_py-1.0.4-cp311-cp311-musllinux_1_2_x86_64.whl
Size 11.4 MB
Tags CPython 3.11 Linux musl 1.2+ x86-64
SHA-256 checksum
How to use checksums
5e8152081c471fa69f24b269f96d3dc2997200d59d52be58d5a8f8fd06b56e11
BLAKE2b-256 checksum
How to use checksums
ccdee7db1fbf99645f23ee77aa8b03c22b3012d8ca72ae3457e05b9e5eb33db0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 7, 2025.

Transparency log

Release files / learner_py-1.0.4-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl

Download URL learner_py-1.0.4-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Size 10.4 MB
Tags CPython 3.11 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
529f882dce6670b88eae451eddacbcd90589d44e58d57f17ba5749cc9d9efbd6
BLAKE2b-256 checksum
How to use checksums
528ec55a7dddf52967a10e58299e8c56414bf716367e805fa2b314e8825334e0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 7, 2025.

Transparency log

Release files / learner_py-1.0.4-cp311-cp311-macosx_10_9_x86_64.whl

Download URL learner_py-1.0.4-cp311-cp311-macosx_10_9_x86_64.whl
Size 346.5 kB
Tags CPython 3.11 macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
84ed7ad8d21a5759d703a9a344535cd16951778f059979c81788cfd235a752fb
BLAKE2b-256 checksum
How to use checksums
34f0aca27ae5cb64432e1a048a82f7c1dfc82f4e6554731060762e66b609e84a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 7, 2025.

Transparency log

Release files / learner_py-1.0.4-cp310-cp310-win_amd64.whl

Download URL learner_py-1.0.4-cp310-cp310-win_amd64.whl
Size 236.5 kB
Tags CPython 3.10 Windows x86-64
SHA-256 checksum
How to use checksums
3f6fa3f191a00a39e0a4ab3fbebf03fba118a25995ac0eb3cece2b7305040fc0
BLAKE2b-256 checksum
How to use checksums
0975ab5763b90e9936175b49b6c6135e53dd53bdff6a290adb86b1e55a5bed7b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 7, 2025.

Transparency log

Release files / learner_py-1.0.4-cp310-cp310-musllinux_1_2_x86_64.whl

Download URL learner_py-1.0.4-cp310-cp310-musllinux_1_2_x86_64.whl
Size 11.4 MB
Tags CPython 3.10 Linux musl 1.2+ x86-64
SHA-256 checksum
How to use checksums
d1a8e6b41bcf7381144ab731763d574f8839123ea79c1c82fc78630ca1f4a4ec
BLAKE2b-256 checksum
How to use checksums
7c990043d9e7da603b9c3c3dc800047b41e1e8798544eeebf689aaac026d8bec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 7, 2025.

Transparency log

Release files / learner_py-1.0.4-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl

Download URL learner_py-1.0.4-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Size 10.3 MB
Tags CPython 3.10 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
1db85c07688291e9af6ef7d8027eda2402dfbcac569ce70e08de2f62d868e999
BLAKE2b-256 checksum
How to use checksums
6342577dd7bc88b75d23f4dae10a21465b2a8253b2f191ae4a24f4547128e442
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 7, 2025.

Transparency log

Release files / learner_py-1.0.4-cp310-cp310-macosx_10_9_x86_64.whl

Download URL learner_py-1.0.4-cp310-cp310-macosx_10_9_x86_64.whl
Size 345.0 kB
Tags CPython 3.10 macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
215e298991373d9bd18dd8950babf6b8b04a5d44e709431e24fbf2b156d592b9
BLAKE2b-256 checksum
How to use checksums
d008d05e16b85fec4ca1289090c7ed80722dbf823218ebc32eba6f9958660f5e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 7, 2025.

Transparency log

Release files / learner_py-1.0.4-cp39-cp39-win_amd64.whl

Download URL learner_py-1.0.4-cp39-cp39-win_amd64.whl
Size 236.5 kB
Tags CPython 3.9 Windows x86-64
SHA-256 checksum
How to use checksums
7b963aec5770b8295c5fdd7f9cd878c3c9d0f89ed426f250475dbade075e77b5
BLAKE2b-256 checksum
How to use checksums
91a362e2b2745a07e3806c6e2a837c8e8a50bd31c78606c706f193bfc5c9614a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 7, 2025.

Transparency log

Release files / learner_py-1.0.4-cp39-cp39-musllinux_1_2_x86_64.whl

Download URL learner_py-1.0.4-cp39-cp39-musllinux_1_2_x86_64.whl
Size 11.4 MB
Tags CPython 3.9 Linux musl 1.2+ x86-64
SHA-256 checksum
How to use checksums
5865722aa5ef25eadfbb9ca9b2418a4b61507f83bce26812edc7a02c59321e9b
BLAKE2b-256 checksum
How to use checksums
9ea3ccb33eeaed2a9126717b39844909725142531d660fd87ee0337ee6ca844a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 7, 2025.

Transparency log

Release files / learner_py-1.0.4-cp39-cp39-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl

Download URL learner_py-1.0.4-cp39-cp39-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Size 10.3 MB
Tags CPython 3.9 Linux glibc 2.24+ x86-64 Linux glibc 2.28+ x86-64
SHA-256 checksum
How to use checksums
b97bc4b4cf4ec1f8bfe254214e04ff04e814a3b0a2ec2fc39d3d98fed69cdec1
BLAKE2b-256 checksum
How to use checksums
43f22d1a29f1bd7f618f4f2f29e0bd8ed16e5b8277cee01615d91114ff8038d8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 7, 2025.

Transparency log

Release files / learner_py-1.0.4-cp39-cp39-macosx_10_9_x86_64.whl

Download URL learner_py-1.0.4-cp39-cp39-macosx_10_9_x86_64.whl
Size 345.1 kB
Tags CPython 3.9 macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
899f0ee9b20cfaff7e1259c3978e22b382c52ac8f0b7583b84001233de6ab9f5
BLAKE2b-256 checksum
How to use checksums
fc8fc56e7a7c1840bb73c04c1edc6db8c880435e63964d3fbe485c219bfbe685
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 7, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

1.0.4 This release

16 release files

1.0.0

5 release files

0.1.0

5 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page