text:
DeepAI

# A New Approach to Adaptive Data Analysis and Learning via Maximal Leakage

There is an increasing concern that most current published research findings are false. The main cause seems to lie in the fundamental disconnection between theory and practice in data analysis. While the former typically relies on statistical independence, the latter is an inherently adaptive process: new hypotheses are formulated based on the outcomes of previous analyses. A recent line of work tries to mitigate these issues by enforcing constraints, such as differential privacy, that compose adaptively while degrading gracefully and thus provide statistical guarantees even in adaptive contexts. Our contribution consists in the introduction of a new approach, based on the concept of Maximal Leakage, an information-theoretic measure of leakage of information. The main result allows us to compare the probability of an event happening when adaptivity is considered with respect to the non-adaptive scenario. The bound we derive represents a generalization of the bounds used in non-adaptive scenarios (e.g., McDiarmid's inequality for c-sensitive functions, false discovery error control via significance level, etc.), and allows us to replicate or even improve, in certain regimes, the results obtained using Max-Information or Differential Privacy. In contrast with the line of work started by Dwork et al., our results do not rely on Differential Privacy but are, in principle, applicable to every algorithm that has a bounded leakage, including the differentially private algorithms and the ones with a short description length.

• 8 publications
• 32 publications
• 8 publications
01/18/2018

### On the Contractivity of Privacy Mechanisms

We present a novel way to compare the statistical cost of privacy mechan...
11/28/2022

### An Alphabet of Leakage Measures

We introduce a family of information leakage measures called maximal α,β...
10/07/2021

### Hyperparameter Tuning with Renyi Differential Privacy

For many differentially private algorithms, such as the prominent noisy ...
10/30/2019

### Chasing Accuracy and Privacy, and Catching Both: A Literature Survey on Differentially Private Histogram Publication

Histograms and synthetic data are of key importance in data analysis. Ho...
05/10/2022

### Pointwise Maximal Leakage

We introduce a privacy measure called pointwise maximal leakage, defined...
11/16/2015

### How much does your data exploration overfit? Controlling bias via information usage

Modern data is messy and high-dimensional, and it is often not clear a p...
10/31/2016

### Bayesian Adaptive Data Analysis Guarantees from Subgaussianity

The new field of adaptive data analysis seeks to provide algorithms and ...

## 1 Introduction

There is an increasing concern that most current published research findings are false [falseResearch, statistCrisis]. This “crisis” is mainly due to the difficulty of analyzing large amounts of data. In particular, the statistical inference theory typically assumes that the tests/procedures to be performed are selected before the data are gathered, i.e., statistical independence. By contrast, the data analysis practice is an inherently adaptive process: new hypotheses and analyses are formulated based on the outcomes of previous tests on the same data.

To circumvent this issue, one could collect fresh samples of data for every new test performed, but this is often expensive and impractical. Alternatively, one could naively divide the original dataset into smaller subsets, and apply each new test to a new subset. However, this severely limits the amount of data available for each test, which in turn negatively affects its accuracy. A more common approach is to save one subset for testing, called the holdout set [genAdap]

, and to reuse it multiple times. This may, however, lead to overfitting to the holdout set itself. This can be observed, for example, in the machine learning competitions Kaggle

or ImageNet

[statValidity]. In these competitions, the participants are given a sequence of samples and are required to provide a model with good prediction capabilities. The model is then tested on a hidden test set by the organizers, and a score is returned to the participants, who can then submit a new model. This procedure is repeated until the end of the competition, wherein the best models are evaluated on yet a different test set: the contrast between the scores obtained at the end and the ones from the continuously reused test set shows significant evidence of overfitting.

The difference between the performance of the model on the training data versus a fresh sample of data is called the generalization error in the machine learning literature. Standard approaches [stability] to bound this error rely on the notion of stability of learning algorithms. Roughly speaking, an algorithm generalizes well if small changes in its input lead to only small changes in its output (i.e., it is stable). A more recent line of work [statValidity, genAdap, algoStability], initiated by Dwork et al. [statValidity], takes adaptivity explicitly into account. These works mainly rely on the notion of differential privacy (which originated in the database security literature [DworkCalibrating]). Besides inducing a suitable notion of stability, differentially private algorithms behave well under composition. That is, a sequence of differentially private algorithms induces a differentially private algorithm, allowing us to make generalization guarantees even in the adaptive setting. However, as it comes from the privacy literature, differential privacy is quite restrictive, which led to the introduction of more relaxed notions (that still behave well under composition) such as -max information,  [genAdap, maxInfo].

In this paper, we view the learning algorithms as conditional distributions, and provide generalization guarantees using the notion of maximal leakage. Maximal leakage is a secrecy metric that has appeared both in the computer security literature [CompSecQuantLeakage, LeakageGeneralized, CompSecAddMultMaxLeakage], and the information theory literature [leakage]

. It quantifies the leakage of information from a random variable

to another random variable , and is denoted by . The basic insight is as follows: if a learning algorithm leaks little information about the training data, then it will generalize well. Moreover, similarly to differential privacy, maximal leakage behaves well under composition: we can bound the leakage of a sequence of algorithms if each of them has bounded leakage. It is also robust against post-processing. In addition, it is much less restrictive than differential privacy (e.g., maximal leakage is always bounded for finite random variables, whereas differential privacy can be infinite). As compared to , which is rarely given in closed form, is easier to compute and analyze. Indeed, it is simply given by the following formula (for finite and ):

 L(X→Y)=log∑ymaxx:P(x)>0PY|X(y|x). (1)

### 1.1 Overview of Results

Let and be two random variables distributed over and , respectively, and let be an event. Our first result bounds the probability of

under the joint distribution of

in terms of the marginal distribution of , the fibers (i.e., ), and the leakage from to :

 P(E)≤maxy∈YPX(Ey))⋅exp(L(X→Y)). (2)

This type of bound allows us to connect the probability of an event, measured when the dependence is considered, with the probability of the same event but under the assumption of statistical independence (with the same marginals). Whenever we have independence, we have . Hence , and we retrieve the bound that does not account for the dependence (examples of these bounds, exploited later on, are McDiarmid’s inequality and the significance level used in hypothesis testing to control the false discovery probability). That is, our bounds can recover the classical bounds of the non-adaptive setting. Otherwise, when independence is not satisfied, our bound introduces a multiplicative term that grows as the dependence of on grows. The formal statement and the proof can be found in Section 3.1, Theorem 3.1.

With the suitable choice of what , , and represent, we derive useful bounds in the contexts of both the generalization error and post-selection hypothesis testing. To wit, our main application is the following bound on the generalization error for -loss functions.

###### Theorem (Theorem 3.2 below).

Let be the sample space and be the set of hypotheses. Let be a learning algorithm that, given a sequence of points, returns a hypothesis . Suppose is sampled i.i.d according to some distribution , i.e., . Let . Then,

 P(E)≤2⋅exp(L(S→A(S))−2nη2). (3)

Theorem 3.2 offers a bound on the generalization error that can be exponentially decreasing with since the leakage cannot grow more than linearly in . For instance, if is -DP with , we show that the above bound is exponentially decreasing. However, the bound applies more generally even if does not satisfy -differential privacy for any . More details about this comparison can be found in Section 3.2.

Another connection between generalization error and information-theoretic measures can be found in [learningMI] where, under the same assumption, it is shown that . Whenever our bound is exponentially decreasing in , the improvement in the sample complexity is exponential in the confidence of the bound. This comparison is further discussed in Section 3.4.

Our analysis can be applied for settings more general than the - loss functions:

###### Theorem (Theorem 3.4 below).

Let be an algorithm. Let be a random variable distributed over and let . Given , for every let satisfy . Then,

 P({X∈R(Y)})≤exp(L(X→Y))⋅β. (4)

The idea behind Theorem 3.4 is the following: suppose we have a collection of events and that each of these events has a small probability of occurring. Then, even when , the probability that remains small as long as is small. This implies that, in the spirit of [statValidity], given an algorithm with bounded maximal leakage, adaptive analyses involving can be thought as almost non-adaptive, up to a correction factor equal to .

In [statValidity, Theorem 11], under the assumption of being -DP for some range of values of , it is shown that We thus provide a more general result, as the class of algorithms with bounded leakage is not restricted to the differentially private ones. Furthermore, by exploiting a connection between differential and maximal leakage, we show that our bound is tighter if . Moreover, an immediate consequence of the theorem is that , since , thus recovering the same statement of [genAdap, Theorem 9]. The details of the comparisons can be found in Sections 3.2 and 3.5.

This rewriting of our results allows us to apply them even in the context of adaptive hypothesis testing.

###### Theorem (Theorem 3.5 below).

Let

be an algorithm for selecting a test statistic

. Let be a random dataset over . Suppose that is the significance level chosen to control the false discovery probability for the test statistic . Denote with the event that

selects a statistic such that the null hypothesis is true but its p-value is at most

(event that we make a false discovery using as significance value). Then,

 P(E)≤exp(L(X→A(X)))⋅σ. (5)

Similar results based on are derived in [maxInfo]. However, requires the knowledge of the prior to be correctly computed. By contrast, to compute we only need to know the support of , and partial information about the conditional .

Other than providing generalization guarantees, one important characteristic of maximal leakage is that it is robust under post-processing and composes adaptively.

###### Lemma (Robustness to post-processing, Lemma 2.2 below).

Let and be two algorithms. Then, .

The implication is the following: no matter which post-processing you apply to the outcome of your algorithm, the generalization guarantees provided by having a bounded leakage on will extend to as well, making it a robust measure.

###### Lemma (Adaptive composition, Lemma 2.5 below).

Consider a sequence of algorithms: such that for every the outputs of are inputs to . Then, denoting by the (random) outputs of the algorithm:

 L(X→(A1,…,An))=L(X→An)≤n∑i=1ki. (6)

From this we can derive that if each of the has a bounded leakage (and thus, generalizes), even the adaptive composition of the whole sequence will have bounded leakage (although, with a worse bound) and potentially maintain the generalization guarantees and avoid overfitting. This property is fundamental for practical applications.

### 1.2 More Related Work

In addition to differentially private algorithms, Dwork et al. [genAdap] show that algorithms whose output can be described concisely generalize well. They further introduce -max information to unify the analysis of both classes of algorithms. Consequently, one can provide generalization guarantees for a sequence of algorithms that alternate between differential privacy and short description. In [maxInfo], the authors connect -max information with the notion of approximate differential privacy, but show that there are no generalization guarantees for an arbitrary composition of algorithms that are approximate-DP and algorithms with short description length.

With a more information-theoretic approach, bounds on the exploration bias and/or the generalization error are given in [explBiasMI, infoThGenAn, jiao2017dependence, explBiasLeak], using mutual information and other dependence-measures.

### 1.3 Outline

The work is organized in the following way. In Section 2 we will discuss the problem setting. We will properly define Adaptive Data Analysis in Section 2.1 and Maximal Leakage in Section 2.2, along with the presentation of most of its properties (including robustness to post-processing and adaptive composition). In Section 3 we will present our main results: the generalization guarantees implied by a bound on the maximal leakage (Section 3.1), its application to post-selection hypothesis testing (Section 3.3), we will also compare the measure to Differential Privacy, Mutual Information and Max-Information (Sections 3.2, 3.4, 3.5). For the proofs the reader is referred to the Appendices.

## 2 Problem setting

Before entering into the details of our results, we define the model of adaptive composition we will be considering throughout the exposition and already used in [statValidity, genAdap, maxInfo].

###### Definition 2.1.

Let be a set. Let be a random variable over . Let be a sequence of algorithms such that . Denote with . The adaptive composition of is an algorithm that takes as an input and sequentially executes the algorithms as described by the sequence

ß This level of generality allows us to formalize the behaviour of a data analysts who, after viewing the previous outcomes of the analysis performed, decides what to do next. A potential analyst would execute a sequence of algorithms that are known to have a certain property (e.g. generalize well) when used without adaptivity. The question we would like to address is the following: is this property also maintained by the adaptive composition of the sequence? The answer is not trivial as, for every , the outcome of depends both on and on the previous outputs, that depend on the data themselves. However, when this property is guaranteed by some measure that composes adaptively itself (like differential privacy or, as we will show soon, maximal leakage) then it can be preserved.

For the remainder of this paper, we will only consider finite sets, and is taken to the base .

### 2.2 Maximal Leakage

In this section, we review some basic properties of maximal leakage. As mentioned earlier, the main properties of (approximate) differential privacy and -max information that make them useful for adaptive data analysis are: 1) robustness to post-processing, and 2) adaptive composition. We show that maximal leakage also satisfies these properties, with the advantage of being less restrictive than differential privacy, and easier to analyze than . was introduced as a way of measuring the leakage from to , hence the following definition:

###### Definition 2.2 (Def. 1 of [leakage]).

Given a joint distribution on finite alphabets and , the maximal leakage from to is defined as:

 L(X→Y)=supU−X−Y−^UlogP({U=^U})maxu∈UPU({u}), (7)

where and take values in the same finite, but arbitrary, alphabet.

It is shown in [leakage, Theorem 1] that:

 L(X→Y)=log∑y∈Ymaxx∈X:PX(x)>0PY|X(y|x). (8)

Some important properties of the maximal leakage are the following:

###### Lemma 2.1 ([leakage]).

For any joint distribution on finite alphabets and ,

1. , if the Markov chain

holds.

2. , with equality if and only if and are independent.

3. .

4. .

The following is a direct application of the first property of the lemma:

###### Lemma 2.2 (Robustness to post-processing).

Let be the sample space and let be distributed over . Let and be output spaces, and consider and . Then, .

The useful implication of this result is as follows: any generalization guarantees provided by cannot be invalidated by further processing the output of . In order to analyze the behavior of the adaptive composition of algorithms in terms of maximal leakage, we first need the following definition of conditional maximal leakage

###### Definition 2.3 (Conditional Maximal Leakage [leakageLong]).

Given a joint distribution on alphabets , define:

 L(X→Y|Z)=supU:U−X−Y|ZlogP({U=^U(Y,Z)})P({U=~U(Z)}), (9)

where takes value in an arbitrary finite alphabet and we consider

to be the optimal estimators of

given and , respectively.

Again, it is shown in [leakageLong] that:

 L(X→Y|Z) =log(maxz:PZ(z)>0∑ymaxx:PX|Z(x|z)>0PY|XZ(y|xz)), (10) and L(X→(Y,Z)) ≤L(X→Y)+L(X→Z|Y). (11)

A useful consequence of this inequality is the following result.

###### Lemma 2.3 (Adaptive Composition of Maximal Leakage).

Let be an algorithm such that . Let be an algorithm such that for all . Then .

The proof of this lemma relies crucially on the fact that maximal leakage depends on the marginal only through its support. In order to generalize the result to the adaptive composition of algorithms, we need to lift the property stated in the inequality (11) to more than outputs.

###### Lemma 2.4.

Let and be random variables.

 L(X→(A1,…,An))≤L(X→A1)+L(X→A2|A1)+…+L(X→An|(A1,…,An−1)). (12)

An immediate application of Lemma 2.4 leads us to the following result.

###### Lemma 2.5.

Consider a sequence of algorithms: where for each , . Suppose that for all and for all , . Then, denoting by the (random) outputs of the algorithm:

 L(X→(A1,…,An))=L(X→An)≤n∑i=1ki. (13)

The proofs can be found in Appendix C.

## 3 Main Results

Inspired by the results based on differential privacy [learningDp] and mutual information [learningMI], we derive new bounds using maximal leakage. The underlying intuition is the following: if the outcome of a learning algorithm leaks only little information from the training data, then it will generalize well. In addition to adaptive composition and robustness against post-processing, maximal leakage has the following advantages:

• it can be computed using only a high level description of the conditional distributions and depends on only through the support;

• it allows us to obtain an exponentially decreasing bound in the number of samples of the training set.

### 3.1 Low Leakage implies low generalization error

Our main result allows us to connect the probability of some event happening under the assumption of statistical independence between the input and output random variables and and the probability of the same event, taking into account the dependence of the output from the input. This connection relies on the Rényi divergence of order infinity between the distributions of and , the first one representing the statistical independence scenario and the second one considering the dependence between the two. (In [learningMI], a similar connection is considered, using KL divergence instead.)

###### Theorem 3.1.

Let be a distribution on the space and denote with the marginal distribution of the random variable . Let be an event and for every , denote with the set . Then,

 P(E)≤exp(L(X→Y))⋅maxy∈YPX(Ey). (14)

The proof is in Appendix B

. An immediate application can be found in statistical learning theory and relies on McDiarmid’s inequality. More precisely, the object of study is the generalization error of learning algorithms. To wit:

###### Definition 3.1.

Let be two sets, respectively the domain set and the label set and let . Let be the hypothesis class, i.e. a set of prediction rules . Given , a learning algorithm is a map that, given as an input a finite sequence of domain points-label pairs

, outputs some classifier

.

In order to estimate the capability of some learning algorithm of correctly classifying unseen instances of the domain set i.e. its generalization capability, the concept of generalization error is introduced.

###### Definition 3.2.

Let be some distribution over . The error (or risk) of a prediction rule with respect to is defined as

 LP(h)=E(x,y)∼P(1(h(x)≠y))=P(x,y)∼P(h(x)≠y), (15)

while, given a sample , the empirical error of with respect to is defined as

 LS(h)=1nn∑i=11(h(xi)≠yi). (16)

Moreover, given a learning algorithm , its generalization error with respect to is defined as:

 gen-errP(A,S)=|LP(A(S))−LS(A(S))|. (17)
###### Theorem 3.2.

Let be the sample space and be the set of hypotheses. Let be a learning algorithm that, given a sequence of points, returns a hypothesis . Suppose is sampled i.i.d according to some distribution over , i.e., . Given , let . Then,

 P(E)≤2⋅exp(L(S→A(S))−2nη2). (18)
###### Proof.

Let us denote with the fiber of over . By McDiarmid’s inequality (Lemma A.1), with , we have that for every hypothesis , as the empirical error defined in equation (16) has sensitivity of . Then it follows from Theorem 3.1 that:

 P(E)≤exp(L(S→A(S)))⋅2exp(−2nη2), (19)

as desired. ∎

Whenever is independent from the samples we have that and we immediately fall back to the non-adaptive scenario. We are hence proposing a generalization of these bounds whenever adaptivity is introduced. A concrete example can be seen with Theorem 3.2: in this particular case, whenever is independent from we immediately retrieve that i.e. McDiarmid’s inequality with sensitivity .

### 3.2 Maximal Leakage and Differential Privacy

In the line of work started by Dwork et al. [statValidity, genAdap], the idea is to exploit the stability induced by differential privacy in order to derive generalization guarantees. The notion of algorithms that we will be considering is slightly more general than the notion of learning algorithms exposed before. Before proceeding to the comparison let us state a simple, but useful relationship between maximal leakage and pure differential privacy, proved in Appendix C.

###### Lemma 3.1.

Let be an -Differentially Private randomized algorithm, then .

This suggests an immediate application of Theorem 3.2. Indeed, suppose is an -DP algorithm, then:

 exp(L(X→Y)−2nη2)≤exp(ϵn−2nη2)=exp(−n(2η2−ϵ)) (20)

In order for the bound to be decreasing with , we need leading us to , where represents the accuracy of the generalization error and the privacy parameter. Thus, for fixed , as long as the privacy parameter is smaller than , we have guaranteed generalization capabilities for with an exponentially decreasing bound. For , it is shown in [statValidity, Theorem 9] that It is easy to check that, for large enough , our bound is tighter if . A more general result shown in [statValidity] is the following:

###### Theorem 3.3 (Thm. 11 of [statValidity]).

Let be an differentially private algorithm. Let be a random variable. Let be the corresponding output random variable. Assume that for every there is a subset such that . Then, for we have that

 P({X∈R(Y)})≤3√β. (21)

The theorem just stated shows that, if we have a collection of events and each of these has a small probability of happening, then even considering , with , i.e. introducing adaptivity, the probability will remain small. This theorem, when applied together with McDiarmid’s inequality allows us to characterize the generalization capabilities of DP algorithms, by simply using as the right-hand side of McDiarmid’s inequality. A rephrasing of Theorem 3.1 allows us to compare our results with Theorem 3.3:

###### Theorem 3.4.

Let be an algorithm. Let be a random variable distributed over according to and let . Assume that for every there is a subset with the property that . Then,

 P({X∈R(Y)})≤exp(L(X→Y))⋅β. (22)

The proof is immediate once we have Theorem 3.1. The type of result we are providing here is qualitatively different from the ones derived with differential privacy. We do not pose any constraint on the algorithm itself but rather propose a way of estimating how the probabilities we are interested in change, by measuring the level of dependence we are introducing using maximal leakage.

Now, suppose we have an -differentially private algorithm with . Theorem 3.3 provides a fixed bound of , while with our Theorems 3.4 and 3.1 we obtain that:

 exp(L(X→Y))⋅β

Hence, whenever the privacy parameter is lower than we are able to provide a better bound. In the spirit of comparison with the differential privacy-derived results, let us also state Theorem 3.2 with a general sensitivity :

 P(E)≤2⋅exp(L(X→Y)−2η2c2n) (24)

Corollary 7 of [genAdap] states that whenever an algorithm outputs a function of sensitivity and is DP then, denoting with a random variable distributed over and with we have that . It is easy to see that Theorem (24) provides a tighter bound whenever the accuracy . As already stated before, the family of algorithms with bounded maximal leakage is not restricted to algorithms that are differentially private: a simple example can be found in algorithms with a bounded range, since . This simple relation allows us to immediately retrieve another result stated in [genAdap, Theorem 9]: , showing how Theorem 3.4 is more general than both Theorems 6 and 9 of [genAdap].

### 3.3 Post-selection Hypothesis Testing

As already underlined in [maxInfo], most of the state of the art results that rely on differential privacy provide interesting guarantees only when we are considering low-sensitivity functions. They cannot be applied, for instance, to the problem of adaptively performing hypothesis tests while providing statistical guarantees. The reason for this is that values have a sensitivity larger that [maxInfo, Lemma B.1]. The theorem proven in [algoStability] that relies on DP, when applied to values, provides trivial error guarantees. When applying Theorem 3.2 to p-values, the result we get is the following:

 P(E)≤exp(L(X→Y)−2η2), (25)

suggesting that, in order to get a meaningful bound, according to this measure of leakage, it is necessary to leak very little information about the dataset. More precisely, we need . Notice that in the same framework but without adaptivity, McDiarmid’s inequality itself is not able to provide a better bound than .

Consider instead the problem of bounding the probability of making a false discovery, when the statistics to apply is selected with some data dependent algorithm. In this context, the guarantees that allow to upper-bound this probability by the significance value no longer hold. It is possible to show, using maximal leakage, how to adjust the significance level in these adaptive settings, in order to have a guaranteed bound on the probability of error. As a Corollary of Theorem 3.1 we can retrieve the following:

###### Theorem 3.5.

Let be a data dependent algorithm for selecting a test statistic . Let be a random dataset over . Suppose that is the significance level chosen to control the false discovery probability for the test statistic . Denote with the event that selects a statistic such that the null hypothesis is true but its p-value is at most . Then,

 P(E)≤exp(L(X→A(X)))⋅σ (26)

This result suggests a very simple approach: if the analyst wishes to achieve a bound of on the probability of making a false discovery in adaptive settings, the significance level to be used should be no higher than . Suppose, as typically done in the field, that we wish to achieve an upper-bound of . Whenever we intend to choose a statistic from a set , one straight-forward approach would be to use as a significance value the quantity . With , this would imply choosing a significance level . The application of Theorem 3.5 is thus almost immediate. Once again, if is independent from , we recover the classical bound of . Also, Theorem 3.5 is similar to a result obtained in [maxInfo] and that uses the notion of approximate max-information instead.

### 3.4 Maximal Leakage and Mutual Information

One interesting result in the field, that connects the generalization error with Mutual Information, under the same assumptions of Theorem 3.2, is the following (Theorem 8 of [learningMI]):

 P(E)≤I(S;A(S))+log22nη2−log2. (27)

Let us compare this result with Theorem 3.2 in terms of sample complexity.

###### Definition 3.3.

Fix . Let be an hypothesis class. The sample complexity of with respect to , denoted by , is defined as the smallest for which there exists a learning algorithm such that, for every distribution over the domain yields

 P(gen-errP(A,S)>η)≤δ. (28)

If there is no such then .

From Theorem 3.2, it follows that using a sample size of yields a learner for with accuracy and confidence and this, in turn, implies that . Using the same reasoning with inequality (27), we get The reduction in the sample complexity, in this regime, is exponential in . Moreover, as shown in [learningMI], if we consider the case where and , we have that the VC-dimension of is and, being , our bound recovers exactly the VC-dimension bound [learningBook], which is always sharp.

### 3.5 Maximal Leakage and Max Information

One of the main reasons that brought to the definition of approximate max-information is related to the generalization guarantees it provides, now recalled for convenience.

###### Lemma 3.2 (Generalization via Max-Information, Thm. 13 of [genAdap]).

Let be a random dataset in and let be such that for some , then, for any event :

 P(X,A(X))({(X,A(X))∈O})≤ek⋅PX×A(X)({(X,A(X))∈O})+β (29)

The result looks quite similar to Theorem 3.2, but the two measures, max-information and maximal leakage, although related, can be quite different. In this section we will analyze the connections and differences between the two measures underlining the corresponding implications. Thanks to the constraint on the distributions that a bound on max-information imposes, we can formalize the following connection.

###### Theorem 3.6.

Let be a randomized algorithm such that . Then,

###### Proof.

. Having a bound of on the Max-Information of means that for all and ; and this implies that

With respect to -approximate max-information instead, we can state the following.

###### Theorem 3.7.

Let be a randomized algorithm. Let be a random variable distributed over and let . For any

 Iβ∞(X;A(X))≤L(X→A(X))+log(1β). (30)

Before showing this theorem we need the following, intermediate result. We denote with the distribution associated with .

###### Lemma 3.3 (Lemma 18 of [genAdap] ).

Let be two random variables over the same domain . If then .

###### Proof.

Fix any . Denote with , we want to show that using Lemma 3.3. Notice that .
Using Markov Inequality we can proceed in the following way:

 P(x,y)∼PXY(P(X=x,Y=y)P(X=x)P(Y=y)≥eL(X→Y)β) ≤EXY[P(X=x,Y=y)P(X=x)P(Y=y)]⋅βeL(X→Y) (31) ≤EY[supx∈XnP(X=x,Y=y)P(X=x)P(Y=y)]⋅βeL(X→Y) (32) =β. (33)

Hence,

Here, the relationship between the measures is inverted, but the role played by can lead to undesirable behaviours of -approx MI. The following example, indeed, shows how -approx MI can be unbounded while, in the discrete case, the maximal leakage between two random variables is always bounded by the logarithm of the smallest cardinality.

###### Example 3.1.

Let us fix a Suppose . We have that . For the approximate max-information we have: . It can thus be arbitrarily large.

Another interesting characteristic of max-information is that, differently from differential privacy, it can be bounded even if we have deterministic algorithms. It is easy to see that whenever there is a deterministic mapping and -Differential Privacy is enforced on it, a lower bound on of is retrieved. Trying to relax it to Differential Privacy does not help either, as one would need rendering it practically useless. Max-information, instead, can be finite, and this observation is implied by the connection with what in literature is known as “description length” of an algorithm, and synthesized in the following result [genAdap]: Let be a randomized algorithm, for every ,

 Iβ∞(A,n)≤log(|Y|β). (34)

In terms of generalization guarantees, according to Lemma 3.2, this translates to:

 P(X,A(X))({(X,A(X))∈O})≤|Y|β⋅PX×A(X)({(X,A(X))∈O})+β (35)

In contrast, the bound on maximal leakage that bounded description length provides is the following:

###### Lemma 3.4.

Let be a randomized algorithm, then .

Lemma 3.4 along with Theorem 3.1, immediately translates in the following generalization guarantees:

 P(X,A(X))({(X,A(X))∈O})≤|Y|⋅maxY=A(X)PX({(X∈OY}) (36)

The bound is different from the one in (35) as on the right-hand side we have
while in (35) appears . For practical purposes though, the quantity is typically bounded for every , as for instance when using McDiarmid’s inequality, like in Theorem 3.2. This would imply a bound on both the max and the expectation, and when such technique is used then our bound is clearly tighter as . It is also worth noticing that (34) can be seen as a consequence of Theorem 3.7 and Lemma 3.4.

Once again, due to the presence of , maximal leakage can provide tighter bounds, as we can see from the following example.

###### Example 3.2.

Let be an algorithm. Denoting with the size of the range of , we can bound Approximate Max-Information by while maximal leakage is always bounded by . Since is typically very small in the key applications, and the corresponding multiplicative factors in the bounds are and , the difference between the two bounds can be substantial.

It is important to also notice that the difference between the two measures is not uniquely restricted to deterministic mechanisms. The following is an example of a randomized mapping where maximal leakage is smaller than -approximate-max-information, for small .

###### Example 3.3.

Consider and (the output of a Binary Erasure Channel, with erasure probability , when X is transmitted). More formally, we have that and the following randomized mapping: and . In this case, the Maximal Leakage is [leakageLong]; while, for -Approximate Max-Information one finds (after a series of computations) that: It is easy to see how for a fixed and for going to , Approximate Max-Information approaches while Maximal Leakage is strictly smaller.

Since we are mostly interested in the regimes where is small, these examples show how using Maximal Leakage provides tighter bounds and, in general, a wider applicability of our results as, in discrete settings, it is always bounded.

## Appendix A Definitions and Tools

###### Definition A.1.

Let

be two discrete random variables defined over the same alphabet

, the max-divergence of from is defined as:

 (37)

while, the approximate max-divergence is defined as:

 Dδ∞(X||Y)=logmaxO⊆X,P({X∈O})>δP({X∈O})−δP({Y∈O}). (38)
###### Definition A.2 (Differential Privacy [genAdap]).

Let . A randomized algorithm is said to be -differentially private if, for all the pairs of datasets that differ in a single component we have that

An important probability tool, often used in the field is McDiarmid’s inequality, a concentration of measure for functions of a certain sensitivity. We will say that a function has sensitivity if

 |f(x1,…,xi,…,xn)−f(x1,…,x′i,…,xn)|≤c∀x1,…,xn,x′i∈Xn+1. (39)
###### Lemma A.1 (McDiarmid’s inequality).

Let be independent random variables taking values in the common alphabet .
Let be a function of sensitivity . For every

 P({f(X1,…,Xn)−E[f(X1,…,Xn)]≥ϵ})≤exp(−2ϵ2n⋅c2). (40)
###### Definition A.3 (Def. 10 of [genAdap]).

Let be two random variables jointly distributed according to . Then, the max-information between and , is defined as follows:

 I∞(X;Y)=D∞(PXY||PXPY), (41)

while, the -approximate max-information is defined as:

 Iβ∞(X;Y)=Dβ∞(PXY||PXPY). (42)

## Appendix B Proof of Theorem 3.1

###### Proof.

Fix , we have the following two distributions on : . Denote with
By definition of Rényi Divergence of order we have [RenyiKLDiv],

 D∞(PX|Y=y||PX)=logsupA⊆XPX|Y=y(A)PX(A)=logsupx:PX|Y=y(x)>0PX|Y=y(x)PX(x) (43)

We can say that, for every :

 PX|Y=y(Ey) =PX|Y=y(Ey)PX(Ey)⋅PX(Ey) (44) ≤exp(D∞(PX|Y=y||PX))⋅PX(Ey) (45) ≤exp(D∞(PX|Y=y||PX))⋅β, (46)

Taking expectation on both sides we get:

 EY(PX|Y=y(Ey)) ≤β⋅EY(exp(D∞(PX


text:
1

### JEE Main 2019 (Online) 11th January Morning Slot

A rigid diatomic ideal gas undergoes an adiabatic process at room temperature. The relation between temperature and volume for this process is TVx = constant, then x is :
A
${5 \over 3}$
B
${2 \over 5}$
C
${3 \over 5}$
D
${2 \over 3}$

## Explanation

For adiabatic process : TV$\gamma $$-1 = constant For diatomic process : \gamma$$-$1 = ${7 \over 5} - 1$

$\therefore$  x = ${2 \over 5}$
2

### JEE Main 2019 (Online) 11th January Morning Slot

Ice at –20oC is added to 50 g of water at 40oC. When the temperature of the mixture reaches 0oC, it is found that 20 g of ice is still unmelted. The amount of ice added to the water was close to (Specific heat of water = 4.2J/g/oC Specific heat of Ice = 2.1J/g/oC Heat of fusion of water at 0oC= 334J/g)
A
100 g
B
60 g
C
50 g
D
40 g

## Explanation

Let amount of ice is m gm.

According to principal of calorimeter heat taken by ice = heat given by water

$\therefore$  20 $\times$ 2.1 $\times$ m + (m $-$ 20) $\times$ 334

= 50 $\times$ 4.2 $\times$ 40

376 m = 8400 + 6680

m = 40.1
3

### JEE Main 2019 (Online) 11th January Evening Slot

Two rods A and B of identical dimensions are at temperature 30°C. If A is heated upto 180oC and B upto ToC, then the new lengths are the same. If the ratio of the coefficients of linear expansion of A and B is 4 : 3, then the value of T is
A
200oC
B
270oC
C
230oC
D
250oC

## Explanation

$\Delta {\ell _1} = \Delta {\ell _2}$

$\ell {\alpha _1}\Delta {T_1} = \ell {\alpha _2}\Delta {T_2}$

${{{\alpha _1}} \over {{\alpha _2}}} = {{\Delta {T_1}} \over {\Delta {T_2}}}$

${4 \over 3} = {{T - 30} \over {180 - 30}}$

$T = {230^o}C$
4

### JEE Main 2019 (Online) 11th January Evening Slot

When 100 g of a liquid A at 100oC is added to 50 g of a liquid B at temperature 75oC, the temperature of the mixture becomes 90oC. The temperature of the mixture, if 100 g of liquid A at 100oC is added to 50 g of liquid B at 50oC, will be :
A
60oC
B
70oC
C
85oC
D
80oC

## Explanation

100 $\times$ SA $\times$ [100 $-$ 90] = 50 $\times$ SB $\times$ (90 $-$ 75)

2SA = 1.5 SB

SA = ${3 \over 4}$SB

Now, 100 $\times$ SA $\times$ [100 $-$ T] = 50 $\times$ SB (T $-$ 50)

2 $\times$ $\left( {{3 \over 4}} \right)$ (100 $-$ T) = (T $-$ 50)

300 $-$ 3T = 2T $-$ 100

400 = 5T

T = 80

### EXAM MAP

#### Graduate Aptitude Test in Engineering

GATE CSE GATE ECE GATE ME GATE PI GATE EE GATE CE GATE IN

NEET

format: plain


text:
It is currently 03 Dec 2020, 05:09

### GMAT Club Daily Prep

#### Thank you for using the timer - this advanced tool can estimate your performance and suggest more practice questions. We have subscribed you to Daily Prep Questions via email.

Customized
for You

we will pick new questions that match your level based on your Timer History

Track

every week, we’ll send you an estimated GMAT score based on your performance

Practice
Pays

we will pick new questions that match your level based on your Timer History

# If j and k are integers and j^2/k is odd, which of the follo

Author Message
TAGS:
Founder
Joined: 18 Apr 2015
Posts: 13948
GRE 1: Q160 V160
Followers: 317

Kudos [?]: 3698 [2] , given: 12956

If j and k are integers and j^2/k is odd, which of the follo [#permalink]  27 Aug 2018, 10:00
2
KUDOS
Expert's post
00:00

Question Stats:

20% (01:30) correct 79% (01:36) wrong based on 43 sessions
Active Member
Joined: 29 May 2018
Posts: 126
Followers: 0

Kudos [?]: 112 [0], given: 4

Re: If j and k are integers and j^2/k is odd, which of the follo [#permalink]  29 Aug 2018, 12:23
Got wrong...solution plz..
Manager
Joined: 29 Nov 2017
Posts: 190
Location: United States
GRE 1: Q142 V146
WE: Information Technology (Computer Software)
Followers: 1

Kudos [?]: 94 [0], given: 99

Re: If j and k are integers and j^2/k is odd, which of the follo [#permalink]  31 Aug 2018, 02:55
if we go as per the corrct answerr given here. E/E can be odd or can be even but never an interger. non integers are not considered even or odd in GRE. so
i think the C is wrong choice.

What we can be certain is this that J is divisible by K. Please elucidate me here if I am wrong.
Retired Moderator
Joined: 07 Jun 2014
Posts: 4803
GRE 1: Q167 V156
WE: Business Development (Energy and Utilities)
Followers: 176

Kudos [?]: 3043 [1] , given: 394

Re: If j and k are integers and j^2/k is odd, which of the follo [#permalink]  31 Aug 2018, 06:22
1
KUDOS
Expert's post
IshanGre wrote:
if we go as per the corrct answerr given here. E/E can be odd or can be even but never an interger. non integers are not considered even or odd in GRE. so
i think the C is wrong choice.

What we can be certain is this that J is divisible by K. Please elucidate me here if I am wrong.

Here $$\frac{j^2}{k}$$ is odd that is a given so the statement 'E/E can be odd or can be even ' is irrelevant.

$$\frac{j^2}{k}$$ is an integer and that too odd. So what are values (even or odd) of k if j is even (given)

You have to go backwards it is already given that the fraction is an odd integer.
_________________

Sandy
If you found this post useful, please let me know by pressing the Kudos Button

Try our free Online GRE Test

Intern
Joined: 10 Aug 2018
Posts: 29
Followers: 1

Kudos [?]: 8 [0], given: 2

Re: If j and k are integers and j^2/k is odd, which of the follo [#permalink]  31 Aug 2018, 21:37
VP
Joined: 20 Apr 2016
Posts: 1302
WE: Engineering (Energy and Utilities)
Followers: 22

Kudos [?]: 1342 [1] , given: 251

Re: If j and k are integers and j^2/k is odd, which of the follo [#permalink]  01 Sep 2018, 05:39
1
KUDOS
Arc29 wrote:

Here let us consider the option one at a time:

Option A ::: j and k are both even: It may not be true because if j=1 and k=1 then we can get $$\frac{j^2}{k}= Odd$$

OPtion B::: j = k: it may not be true because if j=5 and k=1; it still satisfy the equation $$\frac{j^2}{k} = Odd$$

Option C ::: If j is even, k is even , this may be true $$\frac{j^2}{k} = odd$$ or $$j^2$$ = k*Odd, so if j = even then k has to be even to satisfy the equation (Even * Odd = Even)

Option D::: If j is divisible by k this may not be true because if j = 3 , k = 9 , it still satisfy the equation $$\frac{j^2}{k} = Odd$$

Option E ::: $$j^2 > k$$ It may not be true, because if j = 1 and k = 1 then $$j^2 = k$$ and it still satisfy the equation $$\frac{j^2}{k} = Odd$$
_________________

If you found this post useful, please let me know by pressing the Kudos Button

Rules for Posting

Got 20 Kudos? You can get Free GRE Prep Club Tests

GRE Prep Club Members of the Month:TOP 10 members of the month with highest kudos receive access to 3 months GRE Prep Club tests

Intern
Joined: 02 Jul 2018
Posts: 9
Followers: 0

Kudos [?]: 9 [1] , given: 1

Re: If j and k are integers and j^2/k is odd, which of the follo [#permalink]  02 Sep 2018, 04:24
1
KUDOS
j^2/k is odd implies that both j^2 and k are odd or both are even. So it is like, if j is odd, k is also odd or if k is even then j is even. It cannot be the case that j^2 is odd and k is even or vice versa, because in such a case you will not get an integer.

Now look at the options:
A) j and k are both even - but they can be odd also. so this is not certain and hence out
B) there is no evidence of j and k being equal. so this is not certain and hence out
C) Compare it with option A. Here it is given that j is even and hence k is even, this is exactly what we have concluded above
D) j is divisible by k. Not necessarily. consider j=4 and k=16
E) j^2 > k : this may not always be the case, consider j = 4 and k = 16

So the correct answer is C
Intern
Joined: 04 Jun 2018
Posts: 5
Followers: 0

Kudos [?]: 0 [0], given: 4

Re: If j and k are integers and j^2/k is odd, which of the follo [#permalink]  20 Dec 2018, 02:25
Sippose j=4 and k=4 then ?it will be 16/4=4 how come C is the right answer
Re: If j and k are integers and j^2/k is odd, which of the follo   [#permalink] 20 Dec 2018, 02:25
Display posts from previous: Sort by


text:
# How do you solve this question?

May 15, 2018

See below

#### Explanation:

(1) $f \left(x\right) = \ln \left(x\right) \implies f \left(1\right) = 0$

${f}^{'} \left(x\right) = \frac{1}{x} \implies {f}^{'} \left(1\right) = 1$
$f ' ' \left(x\right) = - \frac{1}{x} ^ 2 \implies f ' ' \left(1\right) = - 1$
$f ' ' ' \left(x\right) = \frac{\left(- 1\right) \left(- 2\right)}{x} ^ 3 \implies f ' ' ' \left(1\right) = 2$
${f}^{\left(4\right)} \left(x\right) = \frac{\left(- 1\right) \left(- 2\right) \left(- 3\right)}{x} ^ 4 \implies {f}^{\left(4\right)} \left(1\right) = - 6$

The general pattern should be clear from this:

${f}^{\left(n\right)} \left(x\right) = \frac{\left(- 1\right) \left(- 2\right) \ldots \left(- n + 1\right)}{x} ^ n \implies$
 f^((n))(1) =(-1)^(n-1)(n-1)!

(2) So, the Taylor series for $\ln \left(x\right)$ centered at $x = 1$ is given by

ln (x) = sum_{n=0}^oo f^((n))(1)/(n!) (x-1)^n
qquadqquad = sum_{n=0}^oo (-1)^(n-1)((n-1)!)/(n!) (x-1)^n
$q \quad q \quad = {\sum}_{n = 0}^{\infty} {\left(- 1\right)}^{n - 1} {\left(x - 1\right)}^{n} / n$

(3) The $n$-th term in the Taylor series above is given by

${t}_{n} = {\left(- 1\right)}^{n - 1} {\left(x - 1\right)}^{n} / n$

and thus

${t}_{n + 1} / {t}_{n} = - \frac{n}{n + 1} \left(x - 1\right)$

For the series to converge, we must have

${\lim}_{n \to \infty} | {t}_{n + 1} / {t}_{n} | < 1 \implies$

${\lim}_{n \to \infty} | - \frac{n}{n + 1} \left(x - 1\right) | < 1 \implies$

$\textcolor{red}{| x - 1 | < 1}$
which is the domain of convergence.

(4)

$\ln \left(\frac{4}{3}\right) = {\sum}_{n = 0}^{\infty} {\left(- 1\right)}^{n - 1} {\left(\frac{4}{3} - 1\right)}^{n} / n$
$q \quad q \quad = {\sum}_{n = 0}^{\infty} {\left(- 1\right)}^{n - 1} \frac{1}{n {3}^{n}}$

$\ln \left(\frac{2}{3}\right) = {\sum}_{n = 0}^{\infty} {\left(- 1\right)}^{n - 1} {\left(\frac{2}{3} - 1\right)}^{n} / n$
$q \quad q \quad = {\sum}_{n = 0}^{\infty} {\left(- 1\right)}^{n - 1} {\left(- 1\right)}^{n} / \left(n {3}^{n}\right)$

Hence

$\ln \left(2\right) = \ln \left(\frac{4}{3}\right) - \ln \left(\frac{2}{3}\right)$
$q \quad = {\sum}_{n = 0}^{\infty} {\left(- 1\right)}^{n - 1} \frac{1 - {\left(- 1\right)}^{n}}{n {3}^{n}}$

In this sum, all the even terms cancel, so that we get

$\ln \left(2\right) = {\sum}_{n = 0}^{\infty} {\left(- 1\right)}^{2 n + 1 - 1} \frac{2}{\left(2 n + 1\right) {3}^{2 n + 1}}$

and hence

$\ln \left(\sqrt{2}\right) = \frac{1}{2} \ln \left(2\right) = {\sum}_{n = 0}^{\infty} \frac{1}{\left(2 n + 1\right) {3}^{2 n + 1}}$


text:
# 16 Matrices and Arrays

In this chapter we introduce R arrays, which are multidimensional data objects including 2-dimensional arrays better known as matrices, and N-dimensional arrays (generic arrays).

## 16.1 From Vectors to Arrays

In thre previous three chapters, we discussed a number of ideas and concepts that basically have to do with vectors. As you know, a vector is a one-dimensional atomic object. While many data sets can be handled with a vector, there are occasions in which one dimension is not enough. The classic example for when one-dimensional objects are not enough involves working with data that fits better into a tabular structure. This type of structure requires two dimensions: one for rows, and another one for columns.

R provides a handful of rectangular or 2-dimensional objects. One of them is matrix which is a two-dimensional atomic object. In turns out that an R matrix is a special type of multi-dimensional atomic object called array.

So, how do you go from a vector into a generic array? Conceptually, we can transform a vector into an n-dimensional array by giving it a dimensions "dim" attribute with dim():

# simple vector
x <- 1:8
x
#> [1] 1 2 3 4 5 6 7 8

# adding 'dim' attribute: 2 rows, 4 columns
dim(x) <- c(2, 4)
x
#>      [,1] [,2] [,3] [,4]
#> [1,]    1    3    5    7
#> [2,]    2    4    6    8

A couple of things to notice:

• a vector can be given a dim attribute
• a dim attribute is a numeric vector of length n > 2
• R will reorganize the elements of the vector into n dimensions
• each dimension will have as many rows (or columns, etc.) as the n-th value of the dim vector

Here’s another example converting a vector into an array with three dimensions:

# simple vector
x <- 1:8

# dim attribute with 3 dimensions
dim(x) <- c(2, 2, 2)
x
#> , , 1
#>
#>      [,1] [,2]
#> [1,]    1    3
#> [2,]    2    4
#>
#> , , 2
#>
#>      [,1] [,2]
#> [1,]    5    7
#> [2,]    6    8

The vector c(2, 2, 2) passed to dim() indicates that the produced array should have 2 slices (first index 2), each slice containing 2-rows (second index 2) and 2-columns (third index 2).

One important detail to keep in mind when converting a vector into either a matrix or a generic array, is to make sure that the length of the vector matches the product of the values given for each dimension. In the previous examples, we first converted vector x of length 8, into a matrix of 2 rows and 4 columns ($$2 \times 4 = 8$$); and then we converted x into an array of three dimensions each one having 2 elements ($$2 \times 2 \times 2 = 8$$).

We should say that these examples are purely conceptual, and the main purpose is to illustrate the notion of dimensions in atomic objects, and how R can internally generate a matrix or an array from an input vector by giving it a dimensions attribute via the function dim(). We should also say that using dim() like in the above examples, is not really how you should create matrices and arrays. You should instead use dedicated functions such as matrix() and array():

# create a matrix with matrix()
mat <- matrix(1:12, nrow = 3, ncol = 4)
mat
#>      [,1] [,2] [,3] [,4]
#> [1,]    1    4    7   10
#> [2,]    2    5    8   11
#> [3,]    3    6    9   12

# create an array with array()
arr <- array(1:12, dim = c(2, 2, 3))
arr
#> , , 1
#>
#>      [,1] [,2]
#> [1,]    1    3
#> [2,]    2    4
#>
#> , , 2
#>
#>      [,1] [,2]
#> [1,]    5    7
#> [2,]    6    8
#>
#> , , 3
#>
#>      [,1] [,2]
#> [1,]    9   11
#> [2,]   10   12

## 16.2 Matrices

The most common type of array in R is the two-dimensional array also know as matrix. We saw how to take a vector and convert it into a matrix with dim(). In practice, however, the formal way to create matrices is with matrix(), which has the following usage syntax:

matrix(data = NA, nrow = 1, ncol = 1, byrow = FALSE, dimnames = NULL)

To make a 2-by-4 matrix from an input vector x <- 1:8, you use matrix() and specify the number of rows and columns with arguments nrow = 2 and ncol = 4 as follows:

# vector to matrix
x <- 1:8
x
#> [1] 1 2 3 4 5 6 7 8

X <- matrix(x, nrow = 2, ncol = 4)
X
#>      [,1] [,2] [,3] [,4]
#> [1,]    1    3    5    7
#> [2,]    2    4    6    8

What happens when a matrix is created with matrix():

• R always fills up each matrix by columns.

• You can also assign dim-names to an array.

• If you don’t specify names for rows and columns, which is the default value of argument dimnames = NULL, rows and columns will be unnamed.

• As mentioned before, the number of cells in a matrix—given by the product of number of rows and columns—has to match the length of the input vector, otherwise R will give you an error.

Internally, R always stores matrices by columns, and this is technically known as column-major. Many other languages store matrices or 2-dimensional arrays in this form, such as Fortran, Matlab, and Julia (but not like C or Python with "numpy").

Even though internally a matrix is always stored by columns, sometimes you may want to create a matrix by rows. This is possible thanks to the argument byrow.

# vector to matrix (default behavior)
matrix(1:8, nrow = 2, ncol = 4, byrow = FALSE)
#>      [,1] [,2] [,3] [,4]
#> [1,]    1    3    5    7
#> [2,]    2    4    6    8

# vector to matrix (by rows)
matrix(1:8, nrow = 2, ncol = 4, byrow = TRUE)
#>      [,1] [,2] [,3] [,4]
#> [1,]    1    2    3    4
#> [2,]    5    6    7    8

### 16.2.1 Bracket Notation

The matrix mat is a 2-dimensional object: the 1st dimension corresponds to the rows, while the 2nd dimension corresponds to the columns. Because mat has two dimensions, the bracket notation involves working with matrices in this form: mat[ , ].

In other words, you have to specify values inside the brackets for the 1st index, and the 2nd index: mat[index1, index2].

#### Selecting cells

By specifying index vectors in the row and column margins, you can select sets of cells in a matrix. Typically, the input index vectors consist of positive numeric values indicating the position of the row(s) and column(s) to focus on. Likewise, it is also possible to exclude certain rows-and-columns by passing negative numeric indices.

#### Selecting rows

With bracket notation, you can focus just on the rows of a matrix. This is done by specifying a vector for the row index, while leaving empty the position of the columns.

#### Selecting columns

You can also focus just on the columns of a matrix by specifying a vector for the column index, while leaving empty the position of the rows.

#### Row and Column Binding

To combine two or more matrices into a single one, you can use the binding functions rbind() and cbind(). Row binding with rbind() allows you to stack two or more matrices, as long as they have the same number of columns. In turn, column binding with cbind() allows you to join two or more matrices, as long as they have the same number of rows.

#### R objects versus Algebra objects

It is important to distinguish vectors and matrices, especially in R:

• In matrix algebra we use the convention that vectors are column vectors (i.e. they are $$n \times 1$$ matrices).

• In R, a vector with $$n$$ elements is not the same as an $$n \times 1$$ matrix.

• Vectors in R behave more like “row vectors” (especially when displayed).

• However, depending on the type of functions you apply to vectors, sometimes R will handle vectors like if they were column vectors.

#### R matrices versus R data frames

It’s also important to distinguish between a matrix and a data.frame. We haven’t talked that much about data frames (to be formally covered in chapter R Data Frames), but you’ve already worked with them in part III of the book. Both matrices and data frames are tabular structures provided by R, with some similarities and some important differences:

• Both objects allow us to store data in a 2-dimensional object.

• In many cases, both R matrices and data frames have similar behaviors.

• This is mostly the case when they are displayed on the screen.

• And sometimes it is hard to distinguish between a matrix and a data frame by just looking at the displayed content on the screen.

• Arrays store values in an n-dimensional array
• To create an array, give a vector to array() and specify number of dimensions

### 16.2.2 Basic Matrix Operations

We first quickly go through the basic matrix operations in R

• transpose
• scalar multiplication
• matrix-vector multiplication
• matrix-matrix multiplication

### 16.2.3 Transpose

The transpose of a $$n \times p$$ matrix $$\mathbf{X}$$ is the $$p \times n$$ matrix $$\mathbf{X}^{\mathsf{T}}$$. In R the transpose is given by the function t()

# matrix X
X <- matrix(1:6, 2, 3)
X
#>      [,1] [,2] [,3]
#> [1,]    1    3    5
#> [2,]    2    4    6

# transpose of X
t(X)
#>      [,1] [,2]
#> [1,]    1    2
#> [2,]    3    4
#> [3,]    5    6

Matrix addition of two matrices $$\mathbf{A} + \mathbf{B}$$ is defined when $$\mathbf{A}$$ and $$\mathbf{B}$$ have the same dimensions:

A <- matrix(1:6, 2, 3)
B <- matrix(7:9, 2, 3)

A + B
#>      [,1] [,2] [,3]
#> [1,]    8   12   13
#> [2,]   10   11   15

### 16.2.5 Scalar Multiplication

We can multiply a matrix by a scalar using the usual product operator *, moreover it doesn’t matter if we pre-multiply or post-multiply:

X <- matrix(1:3, 3, 4)

# (pre)multiply X by 0.5
(1/2) * X
#>      [,1] [,2] [,3] [,4]
#> [1,]  0.5  0.5  0.5  0.5
#> [2,]  1.0  1.0  1.0  1.0
#> [3,]  1.5  1.5  1.5  1.5

You can also postmultiply by a scalar (although this is not recommended because may confuse readers):

X <- matrix(1:3, 3, 4)

# (post)multiply X by 0.5
X * (1/2)
#>      [,1] [,2] [,3] [,4]
#> [1,]  0.5  0.5  0.5  0.5
#> [2,]  1.0  1.0  1.0  1.0
#> [3,]  1.5  1.5  1.5  1.5

### 16.2.6 Matrix-Matrix Multiplication

The matrix product operator in R is %*%. We can multiply matrices $$\mathbf{A}$$ and $$\mathbf{B}$$ if the number of columns of $$\mathbf{A}$$ is equal to the number of rows of $$\mathbf{B}$$

A <- matrix(1:6, 2, 3)
B <- matrix(7:9, 3, 2)

A %*% B
#>      [,1] [,2]
#> [1,]   76   76
#> [2,]  100  100

We can multiply matrices $$\mathbf{A}$$ and $$\mathbf{B}$$ if the number of columns of $$\mathbf{A}$$ is equal to the number of rows of $$\mathbf{B}$$

A <- matrix(1:6, 2, 3)
B <- matrix(7:9, 3, 2)

B %*% A
#>      [,1] [,2] [,3]
#> [1,]   21   49   77
#> [2,]   24   56   88
#> [3,]   27   63   99

### 16.2.7 Cross-Products

A very common type of products in multivariate data analysis are $$\mathbf{X^{\mathsf{T}} X}$$ and $$\mathbf{X X^{\mathsf{T}}}$$, sometimes known as cross-products:

# cross-product
t(A) %*% A
#>      [,1] [,2] [,3]
#> [1,]    5   11   17
#> [2,]   11   25   39
#> [3,]   17   39   61

# cross-product
A %*% t(A)
#>      [,1] [,2]
#> [1,]   35   44
#> [2,]   44   56

R provides functions crossprod() and tcrossprod() which are formally equivalent to:

• $$\texttt{crossprod(X, X)} \equiv \texttt{t(X) \%*\% X}$$

• $$\texttt{tcrossprod(X, X)} \equiv \texttt{X \%*\% t(X)}$$

However, crossprod() and tcrossprod() are usually faster than using t() and %*%

### 16.2.8 Matrix-Vector Multiplication

We can post-multiply an $$n \times p$$ matrix $$\mathbf{X}$$ with a vector $$\mathbf{b}$$ with $$p$$ elements. This means making linear combinations (weighted sums) of the columns of $$\mathbf{X}$$:

X <- matrix(1:12, 3, 4)
b <- seq(0.25, 1, by = 0.25)

X %*% b
#>      [,1]
#> [1,] 17.5
#> [2,] 20.0
#> [3,] 22.5

In R we can pre-multiply a vector $$\mathbf{a}$$ (with $$n$$ elements) with an $$n \times p$$ matrix $$\mathbf{X}$$. This means making linear combinations (weighted sums) of the rows of $$\mathbf{X}$$:

X <- matrix(1:12, 3, 4)
a <- 1:3

a %*% X
#>      [,1] [,2] [,3] [,4]
#> [1,]   14   32   50   68

Notice that when we use the product operator %*%, R is smart enough to use the convention that vectors are $$n \times 1$$ matrices.

Notice also that if we ask for a vector-matrix multiplication, we can use both formulas:

• a %*% X
• t(a) %*% X

In case you are curious, here are some other interesting functions for matrices

• det(): determinant
• diag(): extract or replace the diagonal elements
• solve(): solve system of equations
• svd(): singular value decomposition
• eigen(): eigen-decomposition
• qr(): QR decomposition
• chol(): Choleski decomposition

## 16.3 Exercises

1) Given the following vector hp, how would you create the matrix displayed below?

# vector of names
hp <- c("Harry", "Potter", "Ron", "Weasley", "Hermione", "Granger")
     [,1]     [,2]
[1,] "Harry"  "Weasley"
[2,] "Potter" "Hermione"
[3,] "Ron"    "Granger"

2) Given the following vector sw, how would you create the matrix displayed below?

# vector of names
sw <- c("Luke", "Skywalker", "Leia", "Organa", "Han", "Solo")
     [,1]   [,2]
[1,] "Luke" "Skywalker"
[2,] "Leia" "Organa"
[3,] "Han"  "Solo"

3) Consider the following vectors a1, a2, a3:

a1 <- c(2, 3, 6, 7, 10)
a2 <- c(1.88, 2.05, 1.70, 1.60, 1.78)
a3 <- c(80, 90, 70, 50, 75)

Column-bind the vectors a1, a2, a3 to form the following matrix A:

#>   a1   a2 a3
#> 1  2 1.88 80
#> 2  3 2.05 90
#> 3  6 1.70 70
#> 4  7 1.60 50
#> 5 10 1.78 75

4) Consider the following vectors b1, b2, b3:

b1 <- c(1, 4, 5, 8, 9)
b2 <- c(1.22, 1.05, 3.60, 0.40, 2.54)
b3 <- c(20, 40, 30, 80, 100)

Row-bind the vectors b1, b2, b3 to form the following matrix B:

#>        1     2    3    4      5
#> b1  1.00  4.00  5.0  8.0   9.00
#> b2  1.22  1.05  3.6  0.4   2.54
#> b3 20.00 40.00 30.0 80.0 100.00

5) With matrices A and B created above, use the matrix-multiplication operator %*% and the transpose function t() to compute the matrix products:

1. $$\mathbf{AB}$$

2. $$\mathbf{BA}$$

3. $$\mathbf{A^\mathsf{T} B^\mathsf{T}}$$

4. $$\mathbf{B^\mathsf{T} A^\mathsf{T}}$$


text:
Change a Driver based on which Scene is being Rendered

I am looking to drive a property in a material node based on the current Scene when rendering. The purpose would be to mix between two different parts of the node tree so that one Scene renders one input of a Mix node, and the other scene renders the other. The objects the material is on exist in one scene, and a group instance of the objects exists in the other scene.

The reason for using different Scenes is that part of the material is regular shaders that need to be GPU rendered, and part are OSL shaders that need to be CPU rendered. So the only difference between the scenes is that one has the device set to GPU and the other CPU.

I know that I could make copies of the objects/materials and so have a different material on the OSL version, but this gets cumbersome as i'll need to re-copy the objects or re-create the whole scene every time I change an object. This is too inefficient while still working on the project. The Group instance means that any changes I make to the models are instantly updated in the other scene, and lets me use the Group to control which models are rendered in the OSL scene at all.

Is this possible?

• Can you provide a simple sample file? Not a fan of using global bpy in driver namespace, as in answer below.. If you set up a scene property and use it as a standard driver variable does it also fail? – batFINGER Feb 15 '19 at 8:29
• @batFINGER I've tried a custom property on a scene to run a driver but that has update problems as well. But the bigger problem is finding a variable that changes during render, and that could be updated mid render as well. I'm not sure one exists. – Ascalon Feb 15 '19 at 9:29
• Can you use methods from prior question rarely use AN. Here is a simple template to set up dud render handlers. blender.stackexchange.com/a/62870/15543 Could see if using handlers will set nodes as desired. – batFINGER Feb 15 '19 at 9:41
• @batFINGER The method for render layers from my old thread doesn't solve this problem. It switches the driver based on the layer I have selected i the UI. So it doesn't trigger when rendering. I'll look into the render handlers. Thanks! – Ascalon Feb 15 '19 at 20:37

render init handler

Hoping the render init handler will do what you desire.

I don't have GPU rendering to test, so all I've done is set the diffuse color of simple material "Material" for different scenes based on there name, and render resolution percentage which both work as expected on the scene being rendered.

import bpy

def render_init(scene):
device = 'CPU'
respc = 100
if scene.name == "Scene":
color = (1, 0, 0, 1)
#device = 'GPU'
else:
color = (0, 1, 0, 1)
respc = 25
bpy.data.materials["Material"].node_tree.nodes['Diffuse BSDF'].inputs['Color'].default_value = color
print("Render", scene.name, color)
# set scene stuff
scene.render.resolution_percentage = respc
#scene.render.cycles.device = device
return None

bpy.app.handlers.render_init.clear()
bpy.app.handlers.render_init.append(render_init)

other methods would be to add a custom property say "GPU" only to a scene that you wish to render on GPU and test for it, rather than checking scene name.

if scene.get("GPU"):
device = 'GPU'

• This is sort of working. I have a scene named Scene and one named Test. And instead of color I am just changing a value to be either 0 or 1. (0 in the If, 1 in the else.) If I hit f12, it renders both Scenes as value 0. But if I render them manually by clicking the render button on their compositor node, then it renders them properly with the switch working. So that's a big help, but why isn't it working with f12 render? And could this be made to work on a render layer basis instead of Scene? If I can switch the driver and device on render layer, I don't need more scenes. – Ascalon Feb 19 '19 at 23:53
• Upon further experimentation, it seems that the problem is that it considers rendering both scenes to be only 1 render. So there's no time for the render handler to update things between them. – Ascalon Feb 20 '19 at 23:32

It is possible to script drivers. Normally if you use a scripted expression as a driver, you can use any function that is defined in any script and added to driver namespace:

import bpy

def f():
if bpy.context.scene.name == 'Scene.001':
return 1
else:
return 0

bpy.app.driver_namespace['f'] = f

'Register' would need to be checked in the Text Editor also the script needs to have .py extension and Auto Run Python Scripts must be enabled for the function to exist every time the file is reloaded.

However apparently this does not work with driving material node properties because Blender's drivers seem to be broken in this area.

It would probably be possible to script an app handler that would take care of it, but at this point I would suggest to simply use a script to switch the mix nodes in all of your materials before rendering. Since this extra step takes only a few seconds it might be easier to have less complexity and you could possibly get away with only one scene as well. You could give the Mix node some specific name in every material like for example "OSL_mix"(in the n panel of the Node Editor). Then you could run this to change the values of the nodes with that name in all your materials at once:

import bpy

for m in bpy.data.materials:
for n in m.node_tree.nodes:
if n.name == "OSL_mix":
n.inputs[0].default_value=1 # or 0

For your convenience you could change the render setting with the script as well by adding something like:

bpy.context.scene.cycles.device = 'CPU' # or 'GPU'
bpy.context.scene.cycles.shading_system = True # that's the OSL
bpy.context.scene.cycles.samples = 1000

Or something like that. You can just change what you want in the render settings and copy the command from the Info panel.

I would just have two scripts like that to switch between CPU-OSL and GPU rendering.

I hope that might be a convenient enough workaround.

• This is working but isn't solving the whole problem because this driver doesn't update regularly, or while rendering. The driver updates the first time I change to a different scene, but doesn't when I change back. To have it update again I have to reload the file. It also doesn't change when rendering. Both scenes render with whatever value was in the driver when I hit the render button. So either it doesn't update during the render at all, or the current scene doesn't change during the render. So this is only doing it based on the current UI state. – Ascalon Feb 15 '19 at 1:02
• Seems to work when I test it: media.giphy.com/media/WygKP5JZ5LDAETRPMV/source.gif Could you maybe edit your question and add more detail about the process you are using for rendering so we can troubleshoot this? – Martynas Žiemys Feb 15 '19 at 9:45
• Drivers in Blender... I sometimes wonder what's the point - they seem not to work most of the time... – Martynas Žiemys Feb 15 '19 at 9:49
• Is it updating during Render for you? There isn't any more detail to add about my render process i'm afraid. I am just hitting f12. – Ascalon Feb 15 '19 at 20:39
• OK, so that's some detail. You are not rendering from command line for example. How are you switching the scenes? Manually as well? As you can see in the GIF, it updates the location of a cube that is linked to both scenes. As it updates, rendering will be correct as well. I will try with materials. – Martynas Žiemys Feb 15 '19 at 22:48


text:
# Three sender quantum simultaneous decoder conjecture

Recently I have started to read about network quantum information theory, where network problems are studied under the classical-quantum channel. For example, capacities of the cq-MAC, cq-broadcast or the cq-interference cannels are studied to characterize the maximum achievable rates possible in such communication scenarios. I found Ivan Savov's PhD thesis to be a really interesting document regarding this issues, and very recommendable for anyone interested to start to study network quantum information theory.

However, in chapter 4.3.1 the author states a conjecture called the three sender quantum simultaneous decoder conjecture, where the existence of a POVM decoder for a cq-channel with three senders is conjectured. Such result is very important to proof most of the results of the thesis and it is an important result in general for network quantum information theory. However, at the time it was unproved, and so it remained as a conjecture. I have been researching to see if such cojecture has been proved, but I have been unable to find a general proof for it (in Classical communication over a quantum interference channel it is proved for an special case, but not in a general way).

Consequently, I was wondering if such conjecture has already been proved and so if it has been, I would like to go through such proof. Note that both references I gave are from 2012, so I assume that advances in the issue have been done by this point.


text:
# Prototypal inheritance

Domains:

In programming, we often want to take something and extend it.

For instance, we have a user object with its properties and methods, and want to make admin and guest as slightly modified variants of it. We'd like to reuse what we have in user, not copy/reimplement its methods, just build a new object on top of it.

Prototypal inheritance is a language feature that helps in that.

## Prototype

In JavaScript, objects have a special hidden property Prototype (as named in the specification), that is either null or references another object. That object is called "a prototype":

That Prototype has a "magical" meaning. When we want to read a property from object, and it's missing, JavaScript automatically takes it from the prototype. In programming, such thing is called "prototypal inheritance". Many cool language features and programming techniques are based on it.

The property Prototype is internal and hidden, but there are many ways to set it.

One of them is to use __proto__, like this:

let animal = {
eats: true
};
let rabbit = {
jumps: true
};

*!*
rabbit.__proto__ = animal;
*/!*

Please note that __proto__ is not the same as Prototype. That's a getter/setter for it. We'll talk about other ways of setting it later, but for now __proto__ will do just fine.

If we look for a property in rabbit, and it's missing, JavaScript automatically takes it from animal.

For instance:

let animal = {
eats: true
};
let rabbit = {
jumps: true
};

*!*
rabbit.__proto__ = animal; // (*)
*/!*

// we can find both properties in rabbit now:
*!*
alert( rabbit.eats ); // true (**)
*/!*

Here the line (*) sets animal to be a prototype of rabbit.

Then, when alert tries to read property rabbit.eats (**), it's not in rabbit, so JavaScript follows the Prototype reference and finds it in animal (look from the bottom up):

Here we can say that "animal is the prototype of rabbit" or "rabbit prototypally inherits from animal".

So if animal has a lot of useful properties and methods, then they become automatically available in rabbit. Such properties are called "inherited".

If we have a method in animal, it can be called on rabbit:

let animal = {
eats: true,
*!*
walk() {
}
*/!*
};

let rabbit = {
jumps: true,
__proto__: animal
};

// walk is taken from the prototype
*!*
rabbit.walk(); // Animal walk
*/!*

The method is automatically taken from the prototype, like this:

The prototype chain can be longer:

let animal = {
eats: true,
walk() {
}
};

let rabbit = {
jumps: true,
__proto__: animal
};

let longEar = {
earLength: 10,
__proto__: rabbit
}

// walk is taken from the prototype chain
longEar.walk(); // Animal walk

There are actually only two limitations:

1. The references can't go in circles. JavaScript will throw an error if we try to assign __proto__ in a circle.
2. The value of __proto__ can be either an object or null. All other values (like primitives) are ignored.

Also it may be obvious, but still: there can be only one Prototype. An object may not inherit from two others.

The prototype is only used for reading properties.

For data properties (not getters/setters) write/delete operations work directly with the object.

In the example below, we assign its own walk method to rabbit:

let animal = {
eats: true,
walk() {
/* this method won't be used by rabbit */
}
};

let rabbit = {
__proto__: animal
}

*!*
rabbit.walk = function() {
};
*/!*

rabbit.walk(); // Rabbit! Bounce-bounce!

From now on, rabbit.walk() call finds the method immediately in the object and executes it, without using the prototype:

For getters/setters -- if we read/write a property, they are looked up in the prototype and invoked.

For instance, check out admin.fullName property in the code below:

let user = {
name: "John",
surname: "Smith",

set fullName(value) {
[this.name, this.surname] = value.split(" ");
},

get fullName() {
return ${this.name}${this.surname};
}
};

__proto__: user,
};

// setter triggers!
admin.fullName = "Alice Cooper"; // (**)

Here in the line (*) the property admin.fullName has a getter in the prototype user, so it is called. And in the line (**) the property has a setter in the prototype, so it is called.

## The value of "this"

An interesting question may arise in the example above: what's the value of this inside set fullName(value)? Where the properties this.name and this.surname are written: user or admin?

The answer is simple: this is not affected by prototypes at all.

No matter where the method is found: in an object or its prototype. In a method call, this is always the object before the dot.

So, the setter actually uses admin as this, not user.

That is actually a super-important thing, because we may have a big object with many methods and inherit from it. Then we can run its methods on inherited objects and they will modify the state of these objects, not the big one.

For instance, here animal represents a "method storage", and rabbit makes use of it.

The call rabbit.sleep() sets this.isSleeping on the rabbit object:

// animal has methods
let animal = {
walk() {
if (!this.isSleeping) {
alert(I walk);
}
},
sleep() {
this.isSleeping = true;
}
};

let rabbit = {
name: "White Rabbit",
__proto__: animal
};

// modifies rabbit.isSleeping
rabbit.sleep();

alert(animal.isSleeping); // undefined (no such property in the prototype)

The resulting picture:

If we had other objects like bird, snake etc inheriting from animal, they would also gain access to methods of animal. But this in each method would be the corresponding object, evaluated at the call-time (before dot), not animal. So when we write data into this, it is stored into these objects.

As a result, methods are shared, but the object state is not.

## Summary

• In JavaScript, all objects have a hidden Prototype property that's either another object or null.
• We can use obj.__proto__ to access it (there are other ways too, to be covered soon).
• The object referenced by Prototype is called a "prototype".
• If we want to read a property of obj or call a method, and it doesn't exist, then JavaScript tries to find it in the prototype. Write/delete operations work directly on the object, they don't use the prototype (unless the property is actually a setter).
• If we call obj.method(), and the method is taken from the prototype, this still references obj. So methods always work with the current object even if they are inherited.

Page structure
Terms


text:
# Liang Hong

On prediction of future insurance claims when the model is uncertain

Date: 10/19/2018
Time: 3:30PM-4:30PM
Place: 315 Armstrong Hall

Abstract: Predictive modeling is arguably one of the most important tasks actuaries face in their day-to-day work. In practice, actuaries may have a number of reasonable models to consider, all of which will provide different predictions. The most common strategy is to first use some kind of model selection tool to select a best model,'' and then use that model to make predictions. However, there is reason to be concerned about the use of the classical distribution theory to develop predictions because these ignore the selection effect. Since accuracy of predictions is crucial to the insurer's pricing and solvency, care is needed to develop valid prediction methods. In this talk, we undertake an investigation of the effects of model selection on the validity of classical prediction tools and make some recommendations for practitioners.

Liang Hong

Dr. Hong received his PhD in mathematics from Purdue University. He has received grants from the Casualty Actuarial Society (CAS), Society of Actuaries (SOA), and State Farm Insurance Company; and he has given research talks at several Center for Actuarial Excellence (CAE) schools including Drake University, Georgia State University, Temple University, University of Waterloo, University of Wisconsin, Madison.

All are welcome.

Date, Location:
2018-10-19


text:
• Definition for "iodine-125"
• light radioactive isotope of iodine with a half-life…
• Sentence for "iodine-125"
• Ionizing radiation can also come from…

# iodine-125 definition

• noun:
• light radioactive isotope of iodine with a half-life of 60 days; used as a tracer in thyroid gland scientific studies and as remedy for hyperthyroidism


text: The ratio of the areas of two similar figures is the square of the ratio of corresponding lengths. So if the areas are in the ratio $16:1$, the lengths are in the ratio $4:1$. So there's your answer, the perimeters are in the ratio $4:1$.


text:
Back to R Programming

## Learner Reviews & Feedback for R Programming by Johns Hopkins University

4.5
stars
21,971 ratings

In this course you will learn how to program in R and how to use R for effective data analysis. You will learn how to install and configure software necessary for a statistical programming environment and describe generic programming language concepts as they are implemented in a high-level statistical language. The course covers practical issues in statistical computing which includes programming in R, reading data into R, accessing R packages, writing R functions, debugging, profiling R code, and organizing and commenting R code. Topics in statistical data analysis will provide working examples....

## Top reviews

EJ

Jul 11, 2016

Excellent course! I already knew a lot about R - but this class helped me solidify what I already knew, taught me lots of new tricks, and now I have a certificate that says I know `something' about R!

WH

Feb 2, 2016

"R Programming" forces you to dive in deep.

These skills serve as a strong basis for the rest of the data science specialization.

Material is in depth, but presented clearly. Highly recommended!

Filter by:

## 1 - 25 of 4,660 Reviews for R Programming

By Jamie R

May 15, 2019

Course content was good, but assignments were too hard and not well linked to the rest of the content. I spent hours online trying to work out the assessments which then leads to the question of why the course

By James C

Jan 7, 2018

I have a rudimentary background in R programming and a lot of experience with computers. I really doubt that someone with no programming experience would be able to complete this course. In many instances, the tools and functions needed to compete programming assignments were not taught. In addition, functions that are taught in the class are not used at all in the homework. The final assignment was unncessarily complicated and time consuming. I would not recommend this class to someone who is new to programming.

By YIQUN H

Apr 14, 2019

The gap between assignments and course content/exercise is too big. Assignments are very difficult to complete without programming knowledge.

By Andrea

Mar 10, 2019

This course lacked organizational structure. The lessons were not in a logical progression and the material jumped around a lot. Furthermore, once a topic was introduced in a video lesson, the practice did not correspond to the lesson just learned. This made it hard to reinforce what was just learned.

I would not recommend this course to someone with no experience with R.

By Philip H

May 14, 2019

I have programmed in SAS before (15 years ago), so I thought that experience would be sufficient for me to take this class. I have to say it is not. This class is definitely not for beginners - you must have programming experience, R experience and/or both. The programming exercises do not follow the lectures and it does not build upon concepts. You will be required to seek help elsewhere (i.e., Stack Overflow) and answers to your questions will take days, if not longer. So, the fact that the classes are organized by week means that you will not conclude in the time you believe you will. I feel that this class is more self-taught than anything else. I have decided to quit this class as it has become extremely frustrating.

By Francesca d l F

Apr 21, 2019

I learned a lot of the R basics, but I was completely lost for the week 2 + 4 'write a function' assignments - they strike at a level too high for a complete beginner for me (and that's after religiously taking notes and completing all swirl exercises.)

By Stefan H

Mar 27, 2019

Very steep learning curve, especially in the beginning. the professor does not have a very engaging way of presenting his material. Also unfortunately he always requires to first think theoretical and then apply some of the learned content this for yourself. However teaching works the other way around:

1) what is the problem we are facing?

2) how can we solve that problem (practically)?

3) how and why does this solution work (theoretically)?

this is proven to be much easier to learn new things and get started. Instead i think this course is set-up for people to struggle by themselves, which i find very frustrating and its not teaching! I ended up teaching myself through trial and error and lots of google search. So what am i paying you for then?

Disappointing

By Wei H

Apr 20, 2019

The assignments are too hard. Wish there were more similar example walk-throughs provided.

By tony k

Mar 10, 2019

I learned a lot, but 1 star because most of the HMW are extremely hard compared to the lessons, and has nothing to do with the lesson, they need more smaller and easier HMWs . The class need to be structured better.

By Pipes M

Feb 26, 2019

The material poorly prepares you for the assignment and expects a deep commitment to a single part just to solve it. I was unable to find help in the forums or online despite doing well on the quizzes and other work. Terrible course.

By Brian W

Feb 20, 2017

Damn near worthless. The course material has significant gaps of information. The programming assignments require knowledge that isn't presented in the course. I had to Google my way through this entire course. I would not recommend it.

By John C S

Jul 11, 2017

Let me start by saying that I did learn some basics of R programming during this course with a lot of help from friends and fellow classmates.

I like to believe that my 20+ professional years in education and training design and delivery have left me with a pretty good understanding of adult learners, learning theory, and putting all of that into practice. With that in mind, here are a couple of points.

First, there is no prerequisite knowledge, skill, or course listed as required for this specialization. Here's what Coursera says about background knowledge, "Some programming experience (in any language) is recommended. We also suggest a working knowledge of mathematics up to algebra (neither calculus or linear algebra are required)." Great! My limited working knowledge of BASIC from the 1980s and novice ability with MS VB fit the bill. Math? No problem, got it covered with Algebra 2 30 years ago. But wait, it turns out neither of those are the case because there are pinned posts in the forum that say the author doesn't understand why an understanding of linear algebra isn't required because it would be really helpful, and you yourself make the point that, "Yes, the mathematics in Statistical Inference and Regression Models are tough for students who haven't previously studied statistics." Knowledge of statistics isn't required or even recommended for this specialization Mr. Greski. That's poor curriculum design and setting students up to fail because there is no realistic expectation set as to what they face in this.

Second, if the materials do not provide any framework or context to tie the assignments to previously taught content either in "lecture", swirl, or assignments, then the course designers and instructors did an incredibly poor job with the design. How can students, even those who have a background in statistics, be reasonably expected to know when an assignment makes use of information or learning that must be found outside of the course itself? This can easily be fixed by including a statement or section with each assignment that says something like, "This assignment covers material found in Lessons, x, y, and z. You will also need information found in sources outside this course such as datacamp.com, etc." The italicized sentence can be the same in every assignment. The paragraph could even say that the assignment is not connected to the current lesson in any way as the intent is for the student to make use of outside resources (or whatever the approriate intent is). Regardless, every graded assignment should have a purpose stating what the student should get out of it, and they could all benefit from a context statement.

Third, if people like me (those with a non-statistics/mathematics background) are not part of the target audience, then please define the target audience better. Currently, Coursera says this, "Beginner Specialization. No prior experience required." That makes it sound like it is appropriate for anyone with no background knowledge or experience because the course will provide all the background knowledge and skills needed along the way. I'm willing to bet that the full program for $3,310 at JHU has prerequisites other than "Beginner Specialization. No prior experience required," and "Some programming experience (in any language) is recommended. We also suggest a working knowledge of mathematics up to algebra (neither calculus or linear algebra are required)." Finally, portions of this specialization that I have completed so far are out of date. There was one quiz question that involves a specific package in R that is not compatible with the latest version of R. That forces the student to guess. Of course, we can take the quizzes over and over again if we are patient enough so it doesn't really matter if we are guessing on the answers or actually learning and getting the correct answers. Does it? While$49/month may not seem like a lot of money to some people, for others it could be quite a bit if they are having difficulty finding a job and working to improve their skill sets and qualifications. Even though it is "just" \$49/month, we are paying for what we presume to be a quality product from a top-notch university. I don't think it's too much to ask that someone correct all the various errors, keep the materials up-to-date with the current version of R (once a year at least), and review feedback such as this (and others) in the forums and Coursera comments. Yes, this means someone has to put the time in on that type of work. I can honestly say that the current state of the materials and quality of design and delivery are well below what I expected for a JHU associated product. I'm not sure I can recommend this to someone as an introduction to data science as it currently exists. I wouldn't be surprised if JHU as an Instructional Design program that could use something like this as a capstone project or similar effort.

I sincerely appreciate the time that the JHU staff, the folks volunteering as mentors, my fellow classmates, and my neighbor give to help me and other students understand the concepts and skills in this course. Our expressed frustration about not seeing a connection between assignments and lectures is not an expressed desire to have our hands held and be spoon fed. It's a frustration at wanting to understand the materials, how they fit together, and how we can use them, which I believe is the intent of education and training in general. Hopefully, Dr. Peng or someone from JHU will see this feedback and be interested in making improvements to the curriculum.

By Laknath

Apr 17, 2019

I would be cautious to recommend this course to a complete beginner. I had been using R for about 6 months before starting this course and found the content challenging. For instance, topics like lexical scoping covered in this course are usually tackled in a more Advanced R course. For a complete beginner into R, I would recommend a book like "R in Action" by Robert Kabacoff or the course on Udemy by Jose Portilla.

However, if you have had some exposure to R and would like it to take it to the next level, this is an excellent course. It will force you to learn things on your own. Read the documentation of R functions, peruse through stack overflow and really step up your game.

By John N

Mar 31, 2019

First off, I would like to thank you Dr. Peng for making this course. I am really happy to be one of his students and got the chance to learn so much about R programming. However, I am giving this course a 3 out 5 after completing it. The reason is that the assignments and final is extremely difficult and they do not connect so much to lecture videos. This course is 100 percent rewarding if someone can put all of their time and energy into it. But the difficulty is that if you are a starting out your programming journey, then this course can be "VERY DIFFICULT." The workload must be taken serious at all time!!

By Marisa P

Jan 20, 2019

I am 100% new to programming and though the videos and Swirl exercises were both very helpful, they were not sufficient preparation for the programming assignments. It's the equivalent of giving two or three easy practice problems and then a high-level math test. How is a newcomer supposed to make that leap? That's why I feel this course is really written for working professionals who already know how to use the R language and who are just looking for a credential. I am disappointed.

By John K

Oct 8, 2017

Videos are difficult to follow along due to speaker.

By kate K

Feb 15, 2019

I tried to take this course 3 or 4 times and each time it turned me off of R. The course assignments do not match the course content and you are expected to really learn on your own by googling and what not. I finally was able to finish the course but it was hard to do it with out googling and finding other peoples answers posted on GitHub or other locations, because I did not want to cheat I did not use these other people answers although maybe that is the Hacker Mentality the professor was talking about. The professor would do well to watch this https://resources.rstudio.com/rstudio-conf-2019/opening-keynote-day2 and maybe read more about how people learn programming.

I am glad I learned R using other courses and came back and finally finished this course but if you are looking to learn R through this course good luck.

By Justin M

Aug 12, 2019

Very challenging, but good course. I've been programming in R for over a year, but there were still some things for me to pick up in this class. Assignments were a challenge, but satisfying to tackle.

By Пичугин Е Р

Feb 25, 2019

It was always too hard to understand this course because of gaps between theory and practice. It will be much easier if you have a lot of exercises step by step mooving us to the final assignment. Like swirl but more sequential.

By Matthew W

Oct 5, 2018

The assignments were way beyond the scope of what was taught in the lectures.

By Jeremy T

Sep 30, 2018

If I wanted to learn from outside source and "hack" my way through understanding, I would not be paying money for this course. I am paying money as I expect a smooth introduction and summary to the topic which it is not. I have taken classes in SQL and python on courser. Those were of better quality. I think this R class is one of the worst.

By Julio G D

Feb 5, 2017

Honestly, I'm very disappointed with this course. The content taught in this course is not in accordance with the assignments. It is like someone taught to be a builder and asked to build the Brooklyn Bridge ... Not fair at all.

If you are going to ask to build a bridge, teach me how. If you teach me how to be a builder ask me for a wall, not a bridge.

Nov 8, 2018

This seemed unnecessarily difficult because I feel there was a huge gap between learning the concepts and the homework. I understand the "developing the hacker mentality" is needed but some things should not take so long. Maybe I'm just an idiot, but learning curve is huge. My recommendation is to be patient and google is your friend,.

By Parth P

Apr 12, 2019

The difficulty curve was too high

By Satyaveer P

Feb 20, 2019

Questions asked in the assignments were on a much higher level than what was taught in the lectures. I get it that I should do my homework and refer other sources, but that defeats the purpose of watching the videos on Coursera itself.

Lectures could be more interactive, instead of simply having a running commentary on a ppt slides.