# Covariance

A statistical measure computed from deviations of two variables from their means.

This is one page of public article previews, not the complete archive. Follow Next page to continue. Summaries are not the original full articles.

## Limitations of Generic Variance Modifiers in Java and Kotlin

DevFeed: [Limitations of Generic Variance Modifiers in Java and Kotlin](<https://devfeed.tech/articles/variance-modifiers-limitations-39219.md>)

Original publisher: [Read original article](<https://kt.academy/article/ak-variance-limitations>)

Published: 2023-02-20T00:15:00Z

Content type: tutorial

Language: en

Sources: [Kt. Academy](<https://devfeed.tech/sources/kt-academy.md>)

Topics: [Generic Variance](<https://devfeed.tech/topics/generic-variance.md>), [Covariance](<https://devfeed.tech/topics/covariance.md>), [Contravariance](<https://devfeed.tech/topics/contravariance.md>), [Type Parameter](<https://devfeed.tech/topics/type-parameter.md>), [Java](<https://devfeed.tech/topics/java.md>), [Kotlin](<https://devfeed.tech/topics/kotlin.md>)

Tags: [contravariance](<https://devfeed.tech/tags/contravariance.md>), [covariance](<https://devfeed.tech/tags/covariance.md>), [generic-variance](<https://devfeed.tech/tags/generic-variance.md>), [java](<https://devfeed.tech/tags/java.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [runtime-errors](<https://devfeed.tech/tags/runtime-errors.md>), [type-parameter](<https://devfeed.tech/tags/type-parameter.md>), [variance](<https://devfeed.tech/tags/variance.md>), [workshop-learning-programming](<https://devfeed.tech/tags/workshop-learning-programming.md>)

### AI overview

This tutorial explains how covariance and contravariance affect generic types in Java and Kotlin. It uses Java's covariant arrays to illustrate runtime type errors and describes why Kotlin restricts variance in public in-positions while allowing safe producer and read-only patterns.

### Source excerpt

What limitations generic variance modifiers introduce, and how can we ignore them.

## Kotlin Generic Variance Modifiers

DevFeed: [Kotlin Generic Variance Modifiers](<https://devfeed.tech/articles/kotlin-generic-variance-modifiers-39218.md>)

Original publisher: [Read original article](<https://kt.academy/article/ak-variance>)

Published: 2023-02-08T00:15:00Z

Content type: article

Language: en

Sources: [Kt. Academy](<https://devfeed.tech/sources/kt-academy.md>)

Topics: [Generic Variance](<https://devfeed.tech/topics/generic-variance.md>), [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [Contravariance](<https://devfeed.tech/topics/contravariance.md>), [Covariance](<https://devfeed.tech/topics/covariance.md>), [Type Parameter](<https://devfeed.tech/topics/type-parameter.md>)

Tags: [contravariance](<https://devfeed.tech/tags/contravariance.md>), [covariance](<https://devfeed.tech/tags/covariance.md>), [generic-variance](<https://devfeed.tech/tags/generic-variance.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [variance](<https://devfeed.tech/tags/variance.md>), [workshop-learning-programming](<https://devfeed.tech/tags/workshop-learning-programming.md>)

### AI overview

This Kotlin tutorial explains invariant, covariant, and contravariant generic type parameters. It shows how variance affects subtype relationships and why covariance is suitable for read-only types, while mutable structures remain invariant for type safety.

### Source excerpt

What are out and in, and how do we use them without even knowing.

## Principal Component Analysis

DevFeed: [Principal Component Analysis](<https://devfeed.tech/articles/principal-component-analysis-40279.md>)

Original publisher: [Read original article](<https://www.jeremykun.com/2012/06/28/principal-component-analysis/>)

Published: 2012-06-28T12:08:44Z

Content type: tutorial

Language: en

Sources: [Jeremy Kun](<https://devfeed.tech/sources/jeremy-kun.md>)

Topics: [Data analysis](<https://devfeed.tech/topics/data-analysis.md>), [NumPy](<https://devfeed.tech/topics/numpy.md>), [Covariance](<https://devfeed.tech/topics/covariance.md>), [Python](<https://devfeed.tech/topics/python.md>)

Tags: [covariance](<https://devfeed.tech/tags/covariance.md>), [data-analysis](<https://devfeed.tech/tags/data-analysis.md>), [eigenvalues](<https://devfeed.tech/tags/eigenvalues.md>), [mathematics](<https://devfeed.tech/tags/mathematics.md>), [principal-component-analysis](<https://devfeed.tech/tags/principal-component-analysis.md>), [programming](<https://devfeed.tech/tags/programming.md>), [python](<https://devfeed.tech/tags/python.md>)

### AI overview

This tutorial explains principal component analysis as a way to reduce a dataset's dimensions by identifying directions of greatest variability. It outlines a Python and NumPy implementation that centers data, computes a covariance matrix, and obtains and sorts eigenvalues and principal components.

### Source excerpt

Problem: Reduce the dimension of a data set, translating each data point into a representation that captures the "most important" features. Solution: in Python import numpy def principalComponents(matrix): # Columns of matrix correspond to data points, rows to dimensions. deviationMatrix = (matrix.T - numpy.mean(matrix, axis=1)).T covarianceMatrix = numpy.cov(deviationMatrix) eigenvalues, principalComponents = numpy.linalg.eig(covarianceMatrix) # sort the principal components in decreasing order of corresponding eigenvalue indexList = numpy.argsort(-eigenvalues) eigenvalues = eigenvalues[indexList] principalComponents = principalComponents[:, indexList] return eigenvalues, principalComponents Discussion: The problem of reducing the dimension of a dataset in a meaningful way shows up all over modern data analysis.