Groups and representations for learning: invariance and equivariance done right
Build symmetry groups and representations, derive equivariant actions and nonlinearities, and compare augmentation with invariant averaging.
After this lesson you can
- Define common symmetry groups and their representations.
- Derive induced signal actions and equivariant map conditions.
- Choose compatible nonlinearities and test equivariance.
- Explain Reynolds averaging and PCA frame limitations.
- Compare augmentation and built-in invariance with measured experiments.
Before you start
- 25Permutation invariance and equivariancePermutation action on graphsEquivariant linear layers on setsDeepSets theorem
- 01Symmetric groupGroup actions
- 02Orthogonal matrixChange of basisKronecker productMatrix exponential
- 24SO(3) exponential and logarithm mapsUnit quaternionSE(3) exponential map
- 13Vapnik-Chervonenkis dimensionVC generalization boundRademacher generalization bound
What symmetry means
Rotating a molecule in space should not change its scalar energy. If the output is a force, it should rotate with the molecule. These conditions differ: the first requires invariance and the second equivariance. Before imposing either, check that the label actually respects the transformation. For example, reflecting a chiral molecule may change a property depending on its environment.
A symmetry group consists of elements with a closed associative operation, identity and inverses. Identity leaves everything unchanged and every transformation can be undone. Composition matters: rotating then reflecting need not equal reflecting then rotating.
The cyclic group has planar rotations generated by a turn of . In this lesson denotes the rotations and reflections of a regular polygon, so its order is ; other texts use the subscript differently. If is a rotation and a reflection, , and . For the group is nonabelian.
The symmetric group contains permutations. contains all planar rotations; additionally includes reflections. Similarly, contains orthogonal matrices with determinant , while also allows determinant . Rotations and reflections act differently in chirality-sensitive problems. Module m24 studies quaternions and exponential maps for parameterizing rotations.
Translations form the additive group . The Euclidean group combines translations and orthogonal transformations; the semidirect product is not an independent sum. Under convention , composing after yields . restricts the orthogonal part to . In a point cloud the same spatial transformation applies to every coordinate; a permutation of points is another symmetry that can act jointly.
A closed set of elements containing identity and inverses is a subgroup if it inherits the operation. For example, square rotations form inside . Square reflection is not in . In three dimensions the 24 rotations mapping a cube to itself form a finite group inside , while its symmetries including reflections form a larger group. Respecting a finite rotation subgroup does not guarantee respecting an intermediate angle.
To check axioms in a finite implementation, enumerate every product, find identity and inverses and verify associativity. Real matrices with trigonometric functions may introduce small residuals even when the mathematical result is exact; the figure uses integer matrices for quarter turns of square and cube. Floating-point comparison needs a tolerance and must not confuse rounding error with structural violation.
Representing the group
A linear representation is a homomorphism : it assigns each element an invertible matrix, with and . Multiplication order reflects the chosen composition convention. An action on vectors that does not respect this law is not a group representation on that space.
The trivial representation assigns scalar one to every element. The permutation representation moves coordinates; for permutation we may define . The regular representation has a coordinate per element of a finite group and permutes them by left multiplication; its dimension is . The standard representation of is the rotation matrix itself acting on a three-dimensional vector.
If and are representations, the direct sum acts by blocks on two spaces and the tensor product acts via . Their dimensions are the sum and product of corresponding dimensions. Under an invertible basis change , matrices describe the same action in other coordinates. An invariant scalar and a rotating vector should not receive the same transformation rule merely because both are stored in an array.
The regular representation of uses four coordinates: if an entry is associated with the identity rotation, multiplying by a quarter turn shifts it to the next rotation’s coordinate. Identity acts as the identity matrix and composing two shifts equals the shift of their product. In the same construction uses eight coordinates; it must not be confused with the two-dimensional geometric representation moving planar points.
The tensor action appears when combining vectors: if and rotate by , outer product transforms as . Vectorizing under a fixed convention gives an action expressible via a Kronecker product. Changing vectorization convention changes factor order; a test with small tensors helps detect that error.
Not every linear layer matrix between vectors is equivariant. If input and output share a rotation representation, matrix must satisfy for every rotation considered. A diagonal matrix with distinct entries generally breaks that condition, as the square shows. For different input and output representations, the correct equation is .
Actions on signals and applications
For a scalar signal defined on a space where acts, the induced action is defined using the inverse:
Thus applying first and then gives , as required by . Using reverses composition order and generally fails for nonabelian groups. For a physical vector field, in addition to moving the argument one must transform the value: for a rigid transformation with linear part .
A map is equivariant if for every element and input. It is invariant if the output representation is trivial. Composition of compatible equivariant maps is equivariant; an invariant readout at the end produces an invariant scalar output. Checking a few transformations is a useful numerical test, not a universal proof.
Input and output representations can differ. For example, a network receiving positions and returning energy uses trivial output; one returning a force per point must rotate each force and permute it when points are renumbered. Translation shifts positions but does not change force vectors. A complete check transforms inputs, outputs and any geometric features according to type.
The toy G-CNN lifts the vector to four frames, applies circular convolution with shared orientation weights, a squared ReLU activation and reconstructs a vector. Under a quarter turn channels permute and the result rotates; for other angles there is no guarantee and this example fails at 45 degrees. The EGNN-like update uses a scalar message depending on distance between two points and multiplies their relative displacement, so it commutes with any planar rotation. The CNN uses a Gaussian image sampled on a three-by-three grid and a directional filter: its scalar output should stay equal if invariant. All are minimal examples with fixed weights, not models fitted to data.
In a continuous image translation shifts the signal argument. In a finite image one must decide boundary behavior: zero padding, cropping or periodicity produce different operators. A CNN may be translation equivariant in an interior region under certain conventions, but padding, stride and pooling can break exact equality for arbitrary shifts. Checking only a centered image can hide boundary errors.
For a point cloud, an affine transformation of positions is not linear in ordinary coordinates because of translation. It can be described as an affine action or written as a matrix using homogeneous coordinates. Differences between two positions simultaneously eliminate translation and rotate as vectors. This distinction helps construct messages based on distances or directions.
Compatible nonlinearities
An equivariant nonlinearity must commute with the representation it receives. Applying the same scalar function to each coordinate commutes with permutation matrices because they only reorder inputs. ReLU does not generally commute with rotations: take and a 45-degree rotation. ReLU after rotation and rotation after ReLU produce different vectors.
By contrast, commutes with every orthogonal matrix because norms are preserved. A scalar gate built from invariant quantities can also multiply a vector without changing its transformation rule. This does not mean every coordinatewise operation commutes only with permutations: ReLU also commutes with positive diagonal scalings, and a scalar linear function commutes with any compatible matrix. The claim depends on function and representation.
Zero is a useful implementation test: a radial rule defined without dividing by the norm works there directly. If a vector is normalized by its norm, define what happens at zero. More general representations require nonlinearities designed for their blocks, not one rule applied indiscriminately to every channel.
Averaging and choosing frames
For a finite group, the Reynolds operator averages over all elements. It is invariant because multiplying every element by a fixed one merely reorders them. Applying it to an already invariant function does not change its value; therefore applying it twice equals applying it once. For compact groups, replace the sum with an integral against normalized Haar measure.
A Monte Carlo average of finitely many rotations is a random approximation: its expectation may be invariant, but a fixed sample is not exactly invariant to all rotations. Using the same rotations in comparisons reduces noise but does not turn an arbitrary rotation set into a closed group. The full translation group is not compact and has no uniform Haar probability measure over all .
In Haar is obtained by taking an angle uniformly on an interval of length . In independently uniform Euler angles do not generally produce the uniform rotation distribution. An alternative is normalizing a four-component Gaussian quaternion; opposite quaternions represent the same rotation. The cell checks orthogonality and determinant, while the SciPy example checks a statistical moment of the rotated axis.
Reynolds cost grows with group size and base-function cost. When averaging predictions one can average logits or probabilities, but the operations are not interchangeable because softmax is nonlinear. Both can produce an invariant function if they use every element of an exact action; they do not necessarily produce the same probabilities or training.
Frame averaging uses a small set of orientations that must transform compatibly with input. For a centered 2D cloud with distinct covariance eigenvalues, the two PCA directions have four sign combinations. Averaging a function over those four frames removes sign ambiguity and is invariant to rotations and reflections under the example’s assumptions.
In a symmetric cloud with repeated eigenvalues, the eigenspace basis can rotate arbitrarily and four signs do not cover every possible basis. Near that degeneracy, an axis choice can jump: even a PCA frame’s sign average can be discontinuous. Canonicalizing to one orientation and fixing signs relative to global axes can break equivariance. Learned canonicalization and frame averaging have compatibility assumptions; a continuous unique canonical choice is not guaranteed for all symmetric inputs.
Consider four symmetric points on axes, with nearly equal variances. If horizontal variance is slightly larger than vertical, the first PCA axis is horizontal; if slightly smaller, it becomes vertical. For a base function sensitive to the first point’s first coordinate, the experiment calculates different limits on either side. Averaging sign changes does not solve axis swapping. This clarifies why checking only an asymmetric cloud is insufficient.
Canonicalization may still be useful despite discontinuities if the domain avoids problematic inputs and sensitivity is acceptable for the application. Measure that sensitivity rather than assuming it. In physical prediction an energy output jump can lead to unstable gradients; in classification it can alter a decision near a symmetric configuration.
Augment data or build symmetry
Data augmentation trains with transformations of existing examples. It can reduce sensitivity and improve generalization when transformation preserves the task, but finite training does not force exact symmetry. An invariant-by-construction model restricts possible functions and can use data better if the assumption is correct; if the label changes under an imposed transformation, the restriction can introduce bias.
Each example contains four ordered vertices: the rectangle has semiaxes 1 and 0.42, and the square semiaxes 0.65. Independent uniform noise between −0.06 and 0.06 is added to each coordinate and the figure is rotated. Train uses angles from −0.3 to 0.3 radians; test uses angles over the full circle. MLPs have 16 ReLU units and train 100 epochs with full-batch gradient descent, binary cross-entropy and learning rate 0.15. Seeds are 100 for train, 200 for test, 31 for initialization and 77 for augmentations. Different sample sizes share the same prefix; horizontal curve positions are equally spaced because each size multiplies the preceding by four.
Group augmentation theory relates averaging over orbits to variance reduction under distribution and loss assumptions; it does not ensure each trained network becomes invariant. Generalization results demonstrate strict advantages under specific models and assumptions, not universal improvement for every task or budget. Also compare training cost, memory and latency when evaluating multiple transformations.
Symmetry error and task error answer different questions. A network always returning the same class distribution is perfectly invariant but may classify poorly. The figure and experiment therefore report both. When comparing models with different budgets, also count how often the base network is evaluated per example and transformation generation cost.
During augmentation retain the original label only when justified. Reflecting text can produce an image outside the use distribution; reversing left and right can change a spatial label; rotating some digits can create semantic ambiguity. A numerical invariance test does not correct a wrong task assumption. In such cases partial symmetry or a nontrivial label action may be more suitable.
Exact averaging over a finite group evaluates the base function once per element. If digital-image transformations use interpolation, even rotating 45 degrees repeatedly may not match a direct 90-degree rotation: cropping and interpolation prevent an exact group action on the grid. The MNIST experiment measures the actual residual and does not promise exact invariance from the name C₈.
Lab: groups, frames and signals
The first cell implements C₄, D₄, S₃, regular and standard representations, direct sums, tensor products and uniform sampling in SO(2) and SO(3). The SO(3) sample normalizes a four-dimensional Gaussian vector to obtain a uniform quaternion on the sphere; this induces Haar measure on rotations. It also computes PCA frame averaging and shows a jump across a degeneracy. Cloud input is centered to remove translations.
import itertools
import numpy as np
def cyclic(n):
elements=list(range(n))
return elements,lambda a,b:(a+b)%n
def dihedral(n):
# (k,f) representa r^k s^f, con s r s = r^-1.
elements=list(itertools.product(range(n),range(2)))
return elements,lambda a,b:((a[0]+(-1)**a[1]*b[0])%n,(a[1]+b[1])%2)
def symmetric(n):
elements=list(itertools.permutations(range(n)))
return elements,lambda a,b:tuple(a[b[i]] for i in range(n))
def rotation(theta):
c,s=np.cos(theta),np.sin(theta);return np.array([[c,-s],[s,c]])
def standard_d(n,g):
k,f=g;return rotation(2*np.pi*k/n)@np.diag([1,(-1)**f])
def permutation_matrix(p):
out=np.zeros((len(p),len(p)))
for i,j in enumerate(p):out[j,i]=1
return out
def regular(elements,mul,g):
out=np.zeros((len(elements),len(elements))); idx={v:i for i,v in enumerate(elements)}
for j,h in enumerate(elements):out[idx[mul(g,h)],j]=1
return out
def direct_sum(a,b):
out=np.zeros((len(a)+len(b),len(a)+len(b)));out[:len(a),:len(a)]=a;out[len(a):,len(a):]=b;return out
def hom_error(elements,mul,rho):
return max(np.linalg.norm(rho(mul(g,h))-rho(g)@rho(h)) for g in elements for h in elements)
def random_so3(rng):
# Normalizar un vector gaussiano en S³ produce un cuaternión Haar uniforme.
q=rng.normal(size=4);q/=np.linalg.norm(q);w,x,y,z=q
return np.array([[1-2*(y*y+z*z),2*(x*y-z*w),2*(x*z+y*w)],
[2*(x*y+z*w),1-2*(x*x+z*z),2*(y*z-x*w)],
[2*(x*z-y*w),2*(y*z+x*w),1-2*(x*x+y*y)]])
def check_axioms(elements,mul,identity):
assert all(mul(a,b) in elements for a in elements for b in elements)
assert all(mul(identity,g)==mul(g,identity)==g for g in elements)
assert all(any(mul(g,h)==mul(h,g)==identity for h in elements) for g in elements)
assert all(mul(mul(a,b),c)==mul(a,mul(b,c)) for a in elements for b in elements for c in elements)
class FiniteGroup:
def __init__(self,elements,mul,identity):
self.elements,self.mul,self.identity=elements,mul,identity
check_axioms(elements,mul,identity)
def regular(self,g):
return regular(self.elements,self.mul,g)
def equivariance_error(f,matrices,samples):
return max(np.linalg.norm(f(g@x)-g@f(x)) for g in matrices for x in samples)
def reynolds(f,x,matrices):
return np.mean([f(g@x) for g in matrices],axis=0)
def pca_frames(points):
centered=points-points.mean(axis=0);cov=centered.T@centered
values,vec=np.linalg.eigh(cov);vec=vec[:,np.argsort(values)[::-1]]
return centered,[[email protected](signs) for signs in itertools.product((-1,1),repeat=2)]
def frame_average(points,f):
x,frames=pca_frames(points);return np.mean([f(x@frame) for frame in frames])
def canonical(points):
x,frames=pca_frames(points);v=frames[-1].copy()
for j in range(2):
if v[np.argmax(abs(v[:,j])),j]<0:v[:,j]*=-1
return x@v
for elements,mul,identity in ((*cyclic(4),0),(*dihedral(4),(0,0)),(*symmetric(3),(0,1,2))):
group=FiniteGroup(elements,mul,identity)
print('Orden grupo:',len(elements),'error regular:',hom_error(elements,mul,group.regular))
d,mul=dihedral(4);s,smul=symmetric(3)
assert hom_error(d,mul,lambda g:standard_d(4,g))<1e-12
assert hom_error(s,smul,permutation_matrix)==0
g,h=(1,0,2),(0,2,1)
pg,ph=permutation_matrix(g),permutation_matrix(h)
# Sobre una señal por posición, P_g f implementa f(g^-1 x).
assert np.array_equal(pg@ph,permutation_matrix(smul(g,h)))
# Usar f(gx) correspondería a P_g^T y revierte el orden para S3.
assert not np.array_equal([email protected],permutation_matrix(smul(g,h)).T)
print('Acción inducida en S3: inversa necesaria')
assert hom_error(d,mul,lambda g:direct_sum(np.ones((1,1)),standard_d(4,g)))<1e-12
assert hom_error(d,mul,lambda g:np.kron(standard_d(4,g),standard_d(4,g)))<1e-12
rng=np.random.default_rng(8);R=random_so3(rng)
assert np.allclose(R.T@R,np.eye(3)) and np.isclose(np.linalg.det(R),1)
so2=rotation(rng.uniform(0,2*np.pi))
assert np.allclose(so2.T@so2,np.eye(2)) and np.isclose(np.linalg.det(so2),1)
print('SO(3): ortogonalidad y determinante 1 OK')
x=np.array([.4,1.2]);mats=[standard_d(4,g) for g in d]; f=lambda v:v[0]**3+v[1]**2
radial=lambda v:v*np.tanh(np.linalg.norm(v));relu=lambda v:np.maximum(v,0)
assert equivariance_error(radial,mats,[x])<1e-12
assert equivariance_error(relu,mats,[x])>.1
print('Error radial:',equivariance_error(radial,mats,[x]),'error ReLU:',equivariance_error(relu,mats,[x]))
avg=reynolds(f,x,mats)
assert all(np.isclose(reynolds(f,g@x,mats),avg) for g in mats)
points=np.array([[2.,0.],[-1.,0.],[0.,.5],[0.,-.5]])
shape=lambda z:z[0,0]**4+z[1,1]**2
ref=frame_average(points,shape);turned=frame_average(points@rotation(.7).T,shape)
assert np.isclose(ref,turned)
print('Reynolds y promediado de marcos PCA: invariancia comprobada')
for eps in (-1e-7,1e-7):
cloud=np.array([[np.sqrt(1+eps),0.],[-np.sqrt(1+eps),0.],[0.,1.],[0.,-1.]])
print('eps=',eps,'canonical primer punto:',np.round(canonical(cloud)[0],5),
'promedio de marcos:',round(frame_average(cloud,lambda z:z[0,0]**4),5))Check rotations with SciPy
This local example uses SciPy’s rotation class and checks a property of its samples. The approximate mean is not a statistical proof of uniformity, and results depend on seed and sample size.
import numpy as np
from scipy.spatial.transform import Rotation
rng=np.random.default_rng(23)
rotations=Rotation.random(2000,random_state=rng).as_matrix()
axis=rotations[:,:,0]
print('Media eje:',np.round(axis.mean(0),3))
print('Media de cuadrados:',np.round((axis**2).mean(0),3))
assert np.allclose((axis**2).mean(0),np.ones(3)/3,atol=.05)
assert np.allclose(rotations.transpose(0,2,1)@rotations,np.eye(3))
assert np.allclose(np.linalg.det(rotations),1)npm run lab and open the connection link.CNN and rotations on MNIST
The following local experiment uses MNIST: 60000 train and 10000 test images. Torchvision downloads images and checks files; the program prints their SHA-256 hashes. In this run the compressed train image file had SHA-256 440fcabf73cc546fa21475e81ea370265605f56be210a4024d2ca8f203523609. It needs PyTorch, Torchvision, download and local storage. Original labels remain when rotating, although a 180-degree turn can make classes such as 6 and 9 visually ambiguous: the invariance assumption is imperfect.
The base CNN has two convolutions and a dense head. All three variants share architecture and epoch count: no augmentation, continuous random rotations during train, and averaging logits over eight 45-degree rotations in both train and test. Training is a nested random subset of 128, 512 or 2048 images. The first 512 test images are evaluated with fixed random angles, three epochs, batch 64, one seed and an RTX 3060 GPU. No model was selected on test.
| Train images | CNN error | Augmented error | C₈ average error |
|---|---|---|---|
| 128 | 91.41 % | 91.41 % | 91.41 % |
| 512 | 79.88 % | 83.20 % | 79.30 % |
| 2048 | 72.07 % | 54.69 % | 45.90 % |
These are short runs and their high errors indicate models are not well converged. With 2048 images, mean absolute residual per class under an additional 45-degree turn was 0.12582, 0.01847 and 0.00333 respectively. At 90 degrees the C₈ average had approximate residual ; at 22.5 degrees it was 0.00517. These measure probability differences on the same 512 images, not classification error. Averaging needs eight CNN evaluations: peak allocated tensors during train were approximately 195 MB versus 31 MB for the other variants. Time and memory depend on device, batch and load.
Successive bilinear interpolation can smooth and crop images; numerical composition of 45-degree turns therefore does not exactly represent the ideal group on the grid. Near-zero values at 90 degrees are explained by quarter-turn grid symmetry and the specific implementation, not a guarantee for every angle. To estimate stable differences, extend training, use more seeds and reserve validation for hyperparameter selection. The cell allows size and epoch changes through environment variables; full test was not run.
import os,time,json,hashlib,math
from pathlib import Path
import torch
from torch import nn
import torch.nn.functional as F
from torchvision.datasets import MNIST
torch.set_num_threads(2)
root=Path(os.environ.get('MNIST_DIR','dataset/oryon-mnist'))
train=MNIST(str(root),train=True,download=True)
test=MNIST(str(root),train=False,download=True)
print('MNIST train/test:',len(train),len(test),flush=True)
hashes={p.name:hashlib.sha256(p.read_bytes()).hexdigest() for p in sorted((root/'MNIST'/'raw').glob('*')) if p.is_file()}
print('SHA-256 raw:',hashes,flush=True)
device=torch.device('cuda' if torch.cuda.is_available() else 'cpu')
sizes=[int(x) for x in os.environ.get('MNIST_SIZES','128,512,2048').split(',')]
test_n=int(os.environ.get('MNIST_TEST','512')); epochs=int(os.environ.get('MNIST_EPOCHS','3')); batch=int(os.environ.get('MNIST_BATCH','64'))
train_x=train.data.float().unsqueeze(1).div_(255);train_y=train.targets
test_x=test.data[:test_n].float().unsqueeze(1).div_(255);test_y=test.targets[:test_n]
order=torch.randperm(len(train),generator=torch.Generator().manual_seed(19))
angles=(torch.rand(test_n,generator=torch.Generator().manual_seed(20))*2-1)*math.pi
def rotate(x,angles):
if not torch.is_tensor(angles): angles=torch.full((len(x),),float(angles),device=x.device)
c,s=angles.cos(),angles.sin();zero=torch.zeros_like(c)
theta=torch.stack((c,-s,zero,s,c,zero),dim=1).reshape(-1,2,3)
grid=F.affine_grid(theta,x.size(),align_corners=False)
return F.grid_sample(x,grid,mode='bilinear',padding_mode='zeros',align_corners=False)
class CNN(nn.Module):
def __init__(self):
super().__init__();self.features=nn.Sequential(nn.Conv2d(1,16,3,padding=1),nn.ReLU(),nn.MaxPool2d(2),nn.Conv2d(16,32,3,padding=1),nn.ReLU(),nn.MaxPool2d(2),nn.Flatten());self.head=nn.Sequential(nn.Linear(32*7*7,64),nn.ReLU(),nn.Linear(64,10))
def forward(self,x):return self.head(self.features(x))
def predict(model,x,average):
if not average:return model(x)
# La interpolación hace que la acción discreta de 45° no sea un grupo exacto.
transformed=torch.cat([rotate(x,k*math.pi/4) for k in range(8)])
return model(transformed).reshape(8,len(x),10).mean(0)
results={}
for n in sizes:
if n>len(train):raise ValueError('MNIST_SIZES supera train')
chosen=order[:n]; results[n]={}
for kind in ('normal','aumentada','promedio_C8'):
torch.manual_seed(17);model=CNN().to(device);opt=torch.optim.Adam(model.parameters(),lr=.001)
rng=torch.Generator().manual_seed(37);started=time.perf_counter()
if device.type=='cuda':torch.cuda.reset_peak_memory_stats();torch.cuda.synchronize()
for epoch in range(epochs):
model.train();perm=torch.randperm(n,generator=rng)
for j in range(0,n,batch):
ids=chosen[perm[j:j+batch]];x=train_x[ids].to(device);y=train_y[ids].to(device)
if kind=='aumentada':
a=(torch.rand(len(x),generator=rng)*2-1).to(device)*math.pi;x=rotate(x,a)
logits=predict(model,x,kind=='promedio_C8')
loss=F.cross_entropy(logits,y);opt.zero_grad();loss.backward();opt.step()
if device.type=='cuda':torch.cuda.synchronize()
elapsed=time.perf_counter()-started;peak=torch.cuda.max_memory_allocated() if device.type=='cuda' else None
model.eval();correct=0;residual={str(a):0.0 for a in (45,90,22.5)}
with torch.no_grad():
for j in range(0,test_n,batch):
x=rotate(test_x[j:j+batch].to(device),angles[j:j+batch].to(device));y=test_y[j:j+batch].to(device)
p=predict(model,x,kind=='promedio_C8').softmax(1);correct+=int((p.argmax(1)==y).sum())
for a in (45,90,22.5):
q=predict(model,rotate(x,a*math.pi/180),kind=='promedio_C8').softmax(1)
residual[str(a)]+=float((p-q).abs().mean(1).sum())
record={'n_train':n,'n_test':test_n,'epochs':epochs,'error':1-correct/test_n,
'residual_mean_per_class':{k:v/test_n for k,v in residual.items()},'seconds_train':round(elapsed,2),'peak_bytes':peak}
results[n][kind]=record;print(kind,record,flush=True)
output=root/'mnist_rotation_results.json';output.write_text(json.dumps({'hashes':hashes,'device':str(device),'results':results},indent=2),encoding='utf8')
npm run lab and open the connection link.Exercises
Step 1 of 3. What value does ρ(g)ρ(h)f take at x?
Step 1 of 3. What happens when x is replaced by ρ(h)x?
Step 1 of 2. What does a permutation do before or after σ?
def is_equivariant(f, rho_in, rho_out, samples):
pass