def main2():
    try:
        c.setup('roadmap.md')
        resp = requests.get(c.get_milestone_url(v._CONFIG_), auth=c.get_basic_auth_credentials(v._CONFIG_))
        if resp.status_code == 200:
            fmt.h1('Technology Roadmap')
            milestones = simplejson.loads(resp.content)
            for milestone in milestones:
                write_milestone(milestone)
            print 'Done.'
        else:
            print 'Unexpected reponse'
            print 'Status: %s' % resp.status_code
    finally:
        c.teardown()
def main2():
    try:
        c.setup('roadmap.md')
        resp = requests.get(c.get_milestone_url(v._CONFIG_),
                            auth=c.get_basic_auth_credentials(v._CONFIG_))
        if resp.status_code == 200:
            fmt.h1('Technology Roadmap')
            milestones = simplejson.loads(resp.content)
            for milestone in milestones:
                write_milestone(milestone)
            print 'Done.'
        else:
            print 'Unexpected reponse'
            print 'Status: %s' % resp.status_code
    finally:
        c.teardown()
def main(use_cache):
    try:
        c.setup('roadmap.md')
        if use_cache:
            with open('milestones.pickle') as f:
                milestones = pickle.load(f)
        else:
            issues = fetch_issues()
            milestones = add_milestones_with_no_issues(into_milestones(issues))
            milestones = sorted(milestones.iteritems(), cmp_due_dates)
            with open('milestones.pickle', 'w') as f:
                pickle.dump(milestones, f)
        fmt.h1('Technology Roadmap')
        write_milestones(milestones)
        print 'Done.'
    finally:
        c.teardown()
def main(use_cache):
    try:
        c.setup('roadmap.md')
        if use_cache:
            with open('milestones.pickle') as f:
                milestones = pickle.load(f)
        else:
            issues = fetch_issues()
            milestones = add_milestones_with_no_issues(into_milestones(issues))
            milestones = sorted(milestones.iteritems(), cmp_due_dates)
            with open('milestones.pickle', 'w') as f:
                pickle.dump(milestones, f)
        fmt.h1('Technology Roadmap')
        write_milestones(milestones)
        print 'Done.'
    finally:
        c.teardown()
示例#5
0
def main(milestone):
    try:
        c.setup("issues.md")
        resp = requests.get(c.get_issues_url(v._CONFIG_), 
                            auth=c.get_basic_auth_credentials(v._CONFIG_),
                            params={'milestone': milestone})
        if resp.status_code == 200:
            fmt.h1("Issues")
            issues = simplejson.loads(resp.content)
            for issue in issues:
                write_issue(issue)
            print "Done."
        else:
            print "Unexpected reponse"
            print "Status: %s" % resp.status_code
    finally:
        c.teardown()
示例#6
0
def main():
    display_plot_of_temperatures()
    plt.savefig("images/testing_training_graph")
    plt.gcf().clear()

    learn(number_of_iterations=100)

    display_plot_of_temperatures()
    mySepLinePlot = build_sep_line_plot()
    mySepLinePlot.title(
        "Plots of temperatures and learning unit activation function")
    plt.savefig("images/activation_line")
    plt.gcf().clear()

    plt.plot(testing_errors)
    plt.ylabel("Euclidean Distance")
    plt.xlabel("Iteration #")
    plt.title("Testing error over iterations")
    plt.savefig("images/testing_error")
    plt.gcf().clear()

    file = open(reportFileName, "w")

    save_markdown_report(file, [
        md.h1("Project 3 Report"),
        md.h2("CMSC 409 - Artificial Intelligence"),
        md.h2("Steven Hernandez"),
        md.p("""1. There would be two input and one output for our unit.
Inputs would be the hour and a bias input while output would be the estimated
temperature at that hour of the day.
In fact, because we have weights for x (hour of the day) and a bias,
we can create the formula net = ax+b which means our unit can simply return net * 1
or the identity."""),
        md.p("""2. The activation function would be some linear function.
Or unit would not have a threshold however.
Whatever the outcome from the linear activation function is
would be the exact result from the learning unit.
If we look at the graph of temperatures for our training
(and testing) data, we can see that the values are basically
just a linear function."""),
        md.image("./images/testing_training_graph.png",
                 "Testing training graph"),
        md.p("3. Outcome of training with days 1-3:"),
        md.p("Euclidean distance comes down from %f to %f" %
             (testing_errors[0], testing_errors[len(testing_errors) - 1])),
        md.image("./images/testing_error.png", "Testing Error"),
        md.p("resulting in an activation as so:"),
        md.image("./images/activation_line.png", "Testing Error"),
        md.p("4."),
        md.table([
            [
                "input", "expected output", "actual output",
                "Euclidean distance"
            ],
            [5, 59.5, output(5), -59.5 + output(5)],
            [6, 64, output(6), -64 + output(6)],
            [7, 68.7, output(7), -68.7 + output(7)],
            [8, 73.65, output(8), -73.65 + output(8)],
            [9, 78.43, output(9), -78.43 + output(9)],
            [10, 82, output(10), -82 + output(10)],
            [11, 85.2, output(11), -85.2 + output(11)],
            [12, 87, output(12), -87 + output(12)],
            [13, 90.67, output(13), -90.67 + output(13)],
        ]),
        md.
        p("5. Learning rate was 0.0005 to keep the learning from going to quickly,"
          "while we went through 100 iterations."),
        md.
        p("Notice from the graph above on Euclidean distances, we reach our peak around the 20th iteration mark"
          ),
        md.
        p("6. As such, after the 20th iteration, we reach a plateau of improvement with our current system."
          ),
        md.
        p("7. Using a more complex network with greater than one unit would allow for more complex output"
          "which would ultimately help us with this problem."),
        md.
        p("Currently, we are stuck with a linear output because the single unit can only learn as such."
          ),
    ])

    file.close()

    print("Markdown Report generated in ./report.md")
    print("Converting Markdown file to PDF with ")
    print(
        "`pandoc --latex-engine=xelatex -V geometry=margin=1in -s -o FINAL_REPORT.pdf "
        + reportFileName + "`")

    os.system(
        "pandoc --latex-engine=xelatex -V geometry=margin=1in -s -o FINAL_REPORT.pdf "
        + reportFileName)
    print("Report created")
示例#7
0
#! /usr/bin/env python
import argparse
import os
import yaml
import markdown as md
from github_scraper import GithubScraper

parser = argparse.ArgumentParser(prog='generate_changelog',
                                 epilog='Use "generate_changelog command -h" for more information about a command.')
parser.add_argument('-c', '--config', action='store', required=True)
parser.add_argument('branch', type=str, action='store')
parser.add_argument('last_date', type=str, action='store')
parser.add_argument('-l', '--latest-date', action='store')

args = parser.parse_args()
config_yml = yaml.load(file(args.config, 'r'))

gh_client = GithubScraper(config_yml['github_api_token'], config_yml['organization'])
repos = config_yml['repositories']
for repo in repos:
    print md.h1(repo)
    gh_client.compare_branch_between(repo, args.branch,
                                     args.last_date,
                                     latest_date_str=args.latest_date)


示例#8
0
def main():
    # Data has been generated, so we don't want to regenerate the data.
    # generate_random_data()

    df = pd.read_csv(dataFileName, header=None)
    sepLineA = pd.read_csv(sepLineAFileName, header=None)
    sepLineB = pd.read_csv(sepLineBFileName, header=None)
    #
    errorMatrix1 = get_confusion_matrix(df, sepLineA)
    errorMatrix2 = get_confusion_matrix(df, sepLineB)

    myPlt = build_height_plot(df, sepLineA)
    myPlt.savefig("images/1d")
    myPlt.gcf().clear()

    myPlt = build_height_weight_plot(df, sepLineB)
    myPlt.savefig("images/2d")
    myPlt.gcf().clear()

    file = open(reportFileName, "w")

    save_markdown_report(file, [
        md.h1("Project 1 Report"),
        md.h2("CMSC 409 - Artificial Intelligence"),
        md.h2("Steven Hernandez"),
        md.p("Fully generated data can be found in `./Project1_data/data.txt"),
        md.h3("*Scenerio 1:* using only height."),
        md.table([["", "Weights"], ["x", sepLineA[0][0]],
                  ["bias", sepLineA[0][1]]]),
        md.p("Assuming the following"),
        md.image("./images/net.png"),
        md.p("Or in this situation: "),
        md.p("1 if 0 <= -a(Height) + bias, otherwise 0"),
        md.p("where *a* is some weight and *1* is male and *0* is female."),
        md.p("In this situation a=" + str(sepLineA[0][0]) + " and bias=" +
             str(sepLineA[0][1])),
        md.image("./images/1d.png"),
        md.table([["", "Predicted Male", "Predicted Female"],
                  ["Actual Male", errorMatrix1[1], errorMatrix1[2]],
                  ["Actual Female", errorMatrix1[3], errorMatrix1[0]]]),
        md.p("**Confusion Matrix**"),
        md.table([
            ["", ""],
            ["Error", 1 - ((errorMatrix1[1] + errorMatrix1[0]) / 4000)],
            ["Accuracy", (errorMatrix1[1] + errorMatrix1[0]) / 4000],
            ["True Positive Rate", errorMatrix1[1] / 2000],
            ["True Negative Rate", errorMatrix1[0] / 2000],
            ["False Positive Rate", errorMatrix1[3] / 2000],
            ["False Negative Rate", errorMatrix1[2] / 2000],
        ]),
        md.h3("*Scenerio 2:* heights and weights."),
        md.table([["", "Weights"], ["x", sepLineB[0][0]],
                  ["y", sepLineB[0][1]], ["bias", sepLineB[0][2]]]),
        md.p("Assuming the following"),
        md.image("./images/net.png"),
        md.p("Or in this situation:"),
        md.p("1 if 0 <= a(Height) - b(Weight) + bias, otherwise 0"),
        md.
        p("where *a* and *b* are some weights and *1* is male and *0* is female."
          ),
        md.p("In this situation a=" + str(sepLineB[0][0]) + " and b=" +
             str(sepLineB[0][1]) + " and bias=" + str(sepLineB[0][2])),
        md.image("./images/2d.png"),
        md.
        p("Notice, Male and Female are on slightly different levels in this graph"
          "so that one does not completely cover up the other."),
        md.p("**Confusion Matrix**"),
        md.table([["", "Predicted Male", "Predicted Female"],
                  ["Actual Male", errorMatrix2[1], errorMatrix2[2]],
                  ["Actual Female", errorMatrix2[3], errorMatrix2[0]]]),
        md.table([
            ["", ""],
            ["Error", 1 - ((errorMatrix2[1] + errorMatrix2[0]) / 4000)],
            ["Accuracy", (errorMatrix2[1] + errorMatrix2[0]) / 4000],
            ["True Positive Rate", errorMatrix2[1] / 2000],
            ["True Negative Rate", errorMatrix2[0] / 2000],
            ["False Positive Rate", errorMatrix2[3] / 2000],
            ["False Negative Rate", errorMatrix2[2] / 2000],
        ]),
        md.h3("Libraries Used"),
        md.p("matplotlib, numpy, pandas, pandoc"),
        md.h3("Selected Code Functions"),
        md.p("Functions used to generate this data and calculations."),
        md.p("The full code can be found in `./project1.py`"),
        md.code(function=generate_random_data),
        md.code(function=plot_male_and_females),
        md.code(function=plot_male_and_females),
        md.code(function=get_confusion_matrix),
    ])

    file.close()

    print("Markdown Report generated in ./report.md")
    print("Convert Markdown file to PDF with ")
    print(
        "`pandoc --latex-engine=xelatex -V geometry=margin=1in -s -o FINAL_REPORT.pdf report.md`"
    )