Did I find the right examples for you? yes no      Crawl my project      Python Jobs

# cogent.maths.stats.util.UnsafeFreqs

All Samples(16)  |  Call(6)  |  Derive(4)  |  Import(6)

```from operator import mul
from random import choice, shuffle, randrange
from cogent.maths.stats.util import UnsafeFreqs as Freqs
from cogent.util.array import cartesian_product
from cogent.maths.stats.test import G_fit
```
```                    curr = all_freqs.get(word, None)
if curr is None:
curr = Freqs({next:1})
all_freqs[word] = curr
else:
```
```        can just feed the whole thing into a single Freqs.
"""
freqs = Freqs('')
for line in self.Text:
freqs += line
```
```    result = dict.fromkeys(map(''.join, cartesian_product([a]*k)))
for k in result:
result[k] = Freqs(dict(zip(a, random_f(len(a)))))
return result

```

```from operator import mul
from random import choice, shuffle, randrange
from cogent.maths.stats.util import UnsafeFreqs as Freqs
from cogent.util.array import cartesian_product
from cogent.maths.stats.test import G_fit
```
```                    curr = all_freqs.get(word, None)
if curr is None:
curr = Freqs({next:1})
all_freqs[word] = curr
else:
```
```        can just feed the whole thing into a single Freqs.
"""
freqs = Freqs('')
for line in self.Text:
freqs += line
```
```    result = dict.fromkeys(map(''.join, cartesian_product([a]*k)))
for k in result:
result[k] = Freqs(dict(zip(a, random_f(len(a)))))
return result

```

```#!/usr/bin/env python
"""Classes for dealing with base, codon, and amino acid usage.
"""
from __future__ import division
from cogent.maths.stats.util import Freqs, Numbers, UnsafeFreqs
```
```class UnsafeBaseUsage(BaseUsageI, UnsafeFreqs):
"""Stores frequencies of the four bases. Does not do any validation.

This class avoids overriding most built-ins, so is much faster than
BaseFreqs (although it is often less convenient).
```
```class UnsafeCodonUsage(CodonUsageI, UnsafeFreqs):
"""Stores frequencies of the four bases. Must access as RNA.

This class avoids overriding most built-ins, so is much faster than
CodonFreqs (although it is often less convenient).
```

```#!/usr/bin/env python
"""Classes for dealing with base, codon, and amino acid usage.
"""
from __future__ import division
from cogent.maths.stats.util import Freqs, Numbers, UnsafeFreqs
```
```class UnsafeBaseUsage(BaseUsageI, UnsafeFreqs):
"""Stores frequencies of the four bases. Does not do any validation.

This class avoids overriding most built-ins, so is much faster than
BaseFreqs (although it is often less convenient).
```
```class UnsafeCodonUsage(CodonUsageI, UnsafeFreqs):
"""Stores frequencies of the four bases. Must access as RNA.

This class avoids overriding most built-ins, so is much faster than
CodonFreqs (although it is often less convenient).
```

```import numpy
from cogent.util.unit_test import TestCase, main
from cogent.maths.stats.util import SummaryStatistics, SummaryStatisticsError,\
Numbers, UnsafeNumbers, Freqs, UnsafeFreqs, NumberFreqs, \
UnsafeNumberFreqs
```

```import numpy