Please stay healthy and well!

2/7

2/21

2/28

5/22

Team Selection

Client Presentations

Project Proposal

Revised Project Proposal

Final Project Documentation

No class

No class

No class

Project Presentations

5/11

No class

Implementation / Testing / Deployment

15 Days

Full-Power

Project Presentations

5/11

5/13

5/15

5/22

Everything needs to be done

Project Presentations

Be loud, be proud!

Stay High-level (nobody wants all the details)

Summarize the problem

Talk about your Plan, Ideas, and Solutions

Describe Main Challenges (1-3)

And how you solved them...

Show something in action (video or live)

Describe final steps to finish in the last weeks..

Opportunity!

Grade!

Project Presentations

10-20 minutes per team

Suggestion: use slides (10 max.)

1. Client and Team

2. Project

3. Initial Plan and Ideas

4. Main Challenge 1

5. Solution 1

6. Show action (video or live)

7. Technologies used

8. Lessons learned, Teamwork enhancements..

9. Final steps to finish

10. Thank you and Questions

Very sorry....

I am proud of you.

Course Evaluations

Please give anonymous feedback

Due this week!

Let's Recap!

Part II

3/9/2020

Lecture 16

Lecture 17

Lecture 18

Developer

IT Operations

has to wait until code is

in production to really be done!

Software Developer

SysAdmins / IT Ops

should know a little bit of both!

Lecture 19

Lecture 20

  //... in main
  Converter *c = new Converter;
  
  float convertedTemp = c->fromFtoC(temp);
  //...

Pointer to the instance!

  //... in main
  Converter *c;
  
  float convertedTemp = c->fromFtoC(temp);
  //...

Wild pointer!

Lecture 21

Dockerfile

Lecture 22

$ docker pull haehn/cs410converter
$ docker run -it haehn/cs410converter

Functions, Classes

Arrays, Vectors

Templates

GIBBS Cluster

Cython

Run our C++ code in Python using Cython

and compare timing against NumPy

Analyze a bunch of numbers and calculate min, max, mean, stddev.

Now: Testing

Lecture 23

Lecture 24

template <typename T>
class Stats {
    
    public:
        static T get_min(std::vector<T> v);
        static T get_max(std::vector<T> v);
        static float get_mean(std::vector<T> v);
        
};

template <typename T>
T Stats<T>::get_min(std::vector<T> v) {
    
    T minvalue = v[0];
    
    for(int i=1; i<v.size(); i++) {
        
        minvalue = std::min(minvalue, v[i]);
        
    }
    
    return minvalue;
}

template <typename T>
T Stats<T>::get_max(std::vector<T> v) {
    
    T minvalue = v[0];
    
    for(int i=1; i<v.size(); i++) {
        
        minvalue = std::max(minvalue, v[i]);
        
    }
    
    return minvalue;
}
template <typename T>
float Stats<T>::get_mean(std::vector<T> v) {
    
    float sum = v[0];
    
    for(int i=1; i<v.size(); i++) {
        
        sum += v[i];
        
    }
    
    sum /= v.size();
    
    return sum;
}

Templated Classes!

Lecture 25

Lecture 26

#include <iostream>
#include <vector>
#include <algorithm>
#include <cassert>
#include <cmath>

template <typename T>
class Stats {
    
    public:
        T get_min(std::vector<T> v);
        T get_max(std::vector<T> v);
        float get_mean(std::vector<T> v);
        float get_stddev(std::vector<T> v);
        
};

template <typename T>
T Stats<T>::get_min(std::vector<T> v) {
    
    T minvalue = v[0];
    
    for(int i=1; i<v.size(); i++) {
        
        minvalue = std::min(minvalue, v[i]);
        
    }
    
    return minvalue;
}

template <typename T>
T Stats<T>::get_max(std::vector<T> v) {
    
    T minvalue = v[0];
    
    for(int i=1; i<v.size(); i++) {
        
        minvalue = std::max(minvalue, v[i]);
        
    }
    
    return minvalue;
}

template <typename T>
float Stats<T>::get_mean(std::vector<T> v) {
    
    float sum = v[0];
    
    for(int i=1; i<v.size(); i++) {
        
        sum += v[i];
        
    }
    
    sum /= v.size();
    
    return sum;
}

template <typename T>
float Stats<T>::get_stddev(std::vector<T> v) {

    float stddev = 0;

    float mean = Stats<T>::get_mean(v);

    for(int i=1; i<v.size(); i++) {
        
        stddev += std::pow(v[i] - mean, 2);
        
    }

    return std::sqrt(stddev / v.size());

}

void test_get_min() {

  std::vector<float> somevalues;

  somevalues.push_back(1.3);
  somevalues.push_back(2);
  somevalues.push_back(3);
  somevalues.push_back(-241);

  Stats<float> stats;
  
  assert(stats.get_min(somevalues)==-241);
  std::cout << "Test OK!" << std::endl;
    
}

void test_get_max() {

  std::vector<float> somevalues;

  somevalues.push_back(1.3);
  somevalues.push_back(2);
  somevalues.push_back(3);
  somevalues.push_back(-241);

  Stats<float> stats;
  
  assert(stats.get_max(somevalues)==3);
  std::cout << "Test OK!" << std::endl;
    
}

void test_get_mean() {

  std::vector<float> somevalues;

  somevalues.push_back(1.3);
  somevalues.push_back(2);
  somevalues.push_back(3);
  somevalues.push_back(-241);

  Stats<float> stats;

  float diff = std::abs(stats.get_mean(somevalues)) - std::abs(-58.675);

  assert(diff < 0.0005);

  std::cout << "Test OK!" << std::endl;
    
}

void test_get_stddev() {

  std::vector<float> somevalues;

  somevalues.push_back(1.3);
  somevalues.push_back(2);
  somevalues.push_back(3);
  somevalues.push_back(-241);

  Stats<float> stats;

  float diff = std::abs(stats.get_stddev(somevalues)) - std::abs(105.26712152899404);

  assert(diff < 0.0005);

  std::cout << "Test OK!" << std::endl;

}

int main()
{
    
  test_get_min();
  test_get_max();
  test_get_mean();
  test_get_stddev();
  
}
from setuptools import setup

from Cython.Build import cythonize

setup(ext_modules=cythonize("statistics.pyx"))
# distutils: language = c++
from libcpp.vector cimport vector

#
# Connection to C++
#
cdef extern from "stats.cc":

  cdef cppclass Stats[T]:
    T get_min(vector[T])
    T get_max(vector[T])
    float get_mean(vector[T])
    float get_stddev(vector[T])

#
# Python Interface
#
cdef class PyStats:
  cdef Stats[float] stats

  def get_min(self, vector[float] v):  
    return self.stats.get_min(v)

  def get_max(self, vector[float] v):
    return self.stats.get_max(v)

  def get_mean(self, vector[float] v):
    return self.stats.get_mean(v)

  def get_stddev(self, vector[float] v):
    return self.stats.get_stddev(v)
    

stats.cc

statistics.pyx

setup.py

import statistics

s = statistics.PyStats()

somevalues = [1.3, 2, 3, -241]

print( s.get_min( somevalues ) )

Lecture 27

Artificial General Intelligence

Lecture 28

Lecture 29

CS410 Recap 2

By Daniel Haehn

CS410 Recap 2

Slides for CS410 Software Engineering at UMass Boston. See https://cs410.net!

  • 456