Skip to content

Commit

Permalink
add plot
Browse files Browse the repository at this point in the history
  • Loading branch information
leconize committed Oct 5, 2017
1 parent cd5ab9d commit 4c85440
Show file tree
Hide file tree
Showing 773 changed files with 125,144 additions and 3 deletions.
16 changes: 14 additions & 2 deletions CoreMLTest/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13173"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
Expand Down Expand Up @@ -63,12 +62,25 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<textView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" fixedFrame="YES" textAlignment="natural" translatesAutoresizingMaskIntoConstraints="NO" id="KcM-V8-93S">
<rect key="frame" x="16" y="20" width="343" height="607"/>
<rect key="frame" x="16" y="20" width="343" height="508"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<fontDescription key="fontDescription" type="system" pointSize="14"/>
<textInputTraits key="textInputTraits" autocapitalizationType="sentences"/>
</textView>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="V65-iF-f65">
<rect key="frame" x="124" y="574" width="127" height="30"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<state key="normal" title="Send to Email"/>
</button>
<button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="kj5-us-xVm">
<rect key="frame" x="124" y="574" width="127" height="30"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<state key="normal" title="Send to Email"/>
<connections>
<action selector="sendEmailBtnAction" destination="fIB-s3-GpO" eventType="touchUpInside" id="E01-hC-hoj"/>
</connections>
</button>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<viewLayoutGuide key="safeArea" id="URU-D8-Jhl"/>
Expand Down
7 changes: 6 additions & 1 deletion CoreMLTest/ShowResultViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ class ShowResultViewController: UIViewController, MFMailComposeViewControllerDel
print(hitRate)

}
@IBAction func sendEmailBtnAction() {
self.sendEmail()
}

func createCsvFrom(result: [DotPosition: [PredictPoint]]) -> String{
var stringResult: String = ""
Expand All @@ -32,6 +35,7 @@ class ShowResultViewController: UIViewController, MFMailComposeViewControllerDel
stringResult.append("\(predictPoint.posX), \(predictPoint.posY),\(predictPoint.toScreenPoint().x),\(predictPoint.toScreenPoint().y)\n")
}
}
print(stringResult)
return stringResult
}

Expand All @@ -40,7 +44,8 @@ class ShowResultViewController: UIViewController, MFMailComposeViewControllerDel
mailMVC.mailComposeDelegate = self
mailMVC.setToRecipients(["[email protected]"])
mailMVC.setSubject("send position")

mailMVC.setMessageBody(self.createCsvFrom(result: predictResults), isHTML: false)
self.present(mailMVC, animated: true, completion: nil)
}

func calAccuracy(result:[DotPosition: [PredictPoint]]) -> Double{
Expand Down
129 changes: 129 additions & 0 deletions PredictPoint Plot/.ipynb_checkpoints/Fibo-checkpoint.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Hello"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [],
"source": [
"import numpy as np"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Dynamic fibo"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"(14930352, 24157817)\n",
"None\n"
]
}
],
"source": [
"def fibo(j):\n",
" a,b = 1, 1\n",
" for _ in range(j):\n",
" a, b = b, a+b\n",
" print(a,b)\n",
"print(fibo(35))"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"9227465\n"
]
}
],
"source": [
"mem = {1: 1, 2: 1}\n",
"def refibo(i):\n",
" if i not in mem:\n",
" mem[i] = refibo(i-1) + refibo(i-2)\n",
" return mem[i]\n",
"print(refibo(35))"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"9227465\n"
]
}
],
"source": [
"def normalfibo(i):\n",
" if i <= 2:\n",
" return 1\n",
" else:\n",
" return normalfibo(i-1) + normalfibo(i-2)\n",
"print(normalfibo(35))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 2",
"language": "python",
"name": "python2"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.13"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Loading

0 comments on commit 4c85440

Please sign in to comment.