Try This
mu = 522 # mean observation | |
max = 859 # max observation, assumed 2 standard deviations above the mean | |
std = (max - mu) / 2.0 # standard deviation | |
z = (1000 - mu) / std # 1,000 is when we have a problem, so what is the z-score of a problem? | |
p = Distribution::Normal.cdf(z) # get the probability of this event | |
# Python version of the same is: p = stats.norm.cdf(z) | |
1 - p # The probability of having a problem |
import unittest | |
from unittest.mock import MagicMock | |
class Bar(object): | |
def thud(self): | |
return "thunk" | |
def baz(self): | |
return self.thud() |
The organizers of Utah County Data Science Meetup all have data needs. Surprise. And we spend a lot of time sourcing, cleaning, and integrating that data into our projects (writing high quality ETL scripts). What if, asks the illustrious Jeff Potter we could share?
Share you ask?
Yes, share data, share scripts.
How do I know that what I have is useful to other people?
require "singleton" | |
class Cohort | |
include Singleton | |
def self.instance | |
@@instance ||= new.db | |
end |
#!/usr/bin/env bash | |
set -e | |
gain=${3-"1"} | |
if [ "$#" -lt 2 ]; then | |
echo "Usage: $0 input.aifc output.aifc [gain=2]" | |
exit 1 | |
else |
Generally, I like to build a rapport with people I teach. Sometimes I'll give stronger answers and sometimes I'll just help them get unstuck but leave them engaged in the question so they can really get the subject. I like to think that my main value is that I've been there many times and I can help people find their confidence as they work. In the examples below I showed a few different approaches that may or may not be appropriate for different students.
Knowing my students is even more important when I choose language. If they're native English speakers and have no issues with metaphor, I prefer the style of communication I use below. A neurological study (I've lost the link) shows a tight correlation with the language centers of our brains when we try and read and understand software code and I've found that this kind of mentality helps people (myself included) get into a productive flow.
Thanks,
David
#! /usr/bin/ruby | |
puts "Space-delimit numbers to multiply" | |
string = gets.chomp | |
until string.length == 0 | |
numbers = string.split(/\s+/).map(&:to_f) | |
result = numbers.reduce(1.0) {|p, e| p * e} | |
puts "Input: #{numbers.inspect}", "Result: ", result, "Another? (return nothing to quit)" | |
string = gets.chomp |