> echo "Hello, $LOGNAME" Hello, Karl > git clone https://github.com/*
Needs to remember the words like below
less, ls, pwd, mkdir, cat, curl, echo, git
console.log("hello!"); hello!
bash
ソフトウェアエンジニアの技術ブログ:Software engineer tech blog
随机应变 ABCD: Always Be Coding and … : хороший
> echo "Hello, $LOGNAME" Hello, Karl > git clone https://github.com/*
Needs to remember the words like below
less, ls, pwd, mkdir, cat, curl, echo, git
console.log("hello!"); hello!
bash
Brain Storm -> Create a Skelelon UI -> Research APIs and Libraries
Choose an Idea -> Create a paper prototype -> get user feedback -> Build APP
Developing nice graphic design
Building the user interface with UIKit
Downloading data from an API
Persisting the data
Working through problems and bug to get the app working well.
Posting the app to the App Store
-Create a Paper Prototype
Street Names
isStreetNamesEnabled()
setStreetNamesEnabled(boolean)
Zoom Gestures
isZoomGesturesEnabled
setZoomGesturesEnabled(boolean)
User Navigation
isUserNavigationEnabled
setUserNavigationEnabled(boolean)
@Override public void onStreetViewPanoramaReady(StreetViewPanorama panorama){ panorama.setPosition(new LatLng(37.400546,-112.108668)); panorama.setStreetNamesEnabled(false); StreetViewPanoramaCamera camera = new StreetViewPanoramaCamera.Builder() .bearing(180) .build(); panorama.animateTo(camera,1000); }
User Interaction
Detect Camera Changes
setOnStreetViewPanoramaCameraChangeList
Detect User Touches on Panorama
setOnStreetViewPanoramaClickListener
Detect Changes to the Panorama
setOnStreetViewPanoramaChangeListener
PolylineOptions().geodesic(true).add(LatLng); PolylineOptions().geodesic(true).add(LatLng) .add(LatLng) .add(LatLng) .add(LatLng);
Use a streetViewPanoramaFragment
<fragment android:name="com.google.adroid.gms.maps.StreetViewPanoramaFragment" android:id="@+id/streetviewpanorama" android:layout_width="match_parent" android:layout_height="match_parent" />
StreetView Main Activity
Edit Activity
Implement OnStreetViewPanoramaReadyCallback
In OnCreate
Create a StreetViewPanoramaFragment Object
Call .getStreetViewPanoramaAsync(this) on it
Override onStreetViewPanoramaReady
Parameter: StreetViewPanorama
setPosition() for Location
Create a StreetViewPanoramaCamera
animate To(camera, ms)
@Override prtected void onCreate(Bundle savedInstanceState){ StreetViewPanoramaFragment StreetViewPanoramaFragment (StreetViewPanoramaFragment) getFragmentManager() .findFragmentById(R.id.streetviewpanorama); streetViewPanoramaFragment.getStreetViewPanoramaAsync(this); } @Override public void onStreetViewPanoramaReady(StreetViewPanorama panorama){ panorama.setPosition(new LatLng(36.0579667,-112.1430996)); StreetViewPanoramaCamera camera = new StreetViewPanoramaCamera.Builder() .bearing(180) .build(); panorama.animateTo(camera,1000); }
MarkerOptions class
position property takes a LatLng
title property takes a string
MarkerOptions renton = new MarkerOptions() .position(new LatLng(47.89805,-122.120502)) .title("renton");
renton = new MarkerOptions() .position(new LatLng(47.48905, -122.120502)) .title("Renton");
renton = new MarkerOptions() .position(new LatLng(47.48905, -122.120502)) .title("Renton") .icon(BitmapDescriptorFactory.fromResource( R.drawable.ic_launcher));
Target, Zoom, Bearing, Tilt
class code: CameraPosition
CameraPosition cp=CameraPosition.builder() .target(LatLong) .zoom(val) .bearing(val) .tilt(val) .build(); map.moveCamera(CameraUpdateFactory.newCameraPosition(cp)); map.animateCamera(CameraUpdateFactory.newCameraPosition(cp), <time in ms>, <callback function>);
Making the map move
Seattle: 47.6204, -122.3491
New York: 40.7127, 74.0059
Dublin: 53,3478, 6.2597
1. Create Blank Activity App
2. Edit build.grade
3. Edit Android.manifest
– meta for Google Service
– meta for API key
– permissions for internet, network state and write external storage
– meta for OpenGL
activity_main.xml
<fragment xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/map" andorid:layout_width="match_parent" android:layout_height="match_parent" android:name="com.google.anroid.gms.maps.MapFragment"/>
Find android Directory on computer
Then run Keytool command
~$ cd ~/ .android .android$ keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android
Setting Up Maps
-set up billing
-create a project
-enable maps API
-set up credential
Google Developer Console
https://console.cloud.google.com/
Billing Account Steps
-Name the account
-Specify country for the Account
-Account Type: Business or Individual
-Payer Detail
-Payment Type
Pick Google Maps Android API “Enable”
Gaussian Kernel and Bandwidth
Mean Integrated Standard Error
E[|Pn-P|^2] = Ef(Pn(x)-P(x))^2*dx
We can technically use MISE or AMISE to select the Optimal Bandwidth
def MahalanobisDist(x, y): covariance_xy = np.cov(x,y, rowvar=0) inv_covariance_xy = np.linalg.inv(covariance_xy) xy_mean = np.mean(x),np.mean(y) x_diff = np.array([x_i - xy_mean[0] for x_i in x]) y_diff = np.array([y_i - xy_mean[1] for y_i in y]) diff_xy = np.transpose([x_diff, y_diff]) md = [] for i in range(len(diff_xy)): md.append(np.sqrt(np.dot(np.dot(np.transpose(diff_xy[i]), inv_covariance_xy),diff_xy[i]))) return md md = MahalanobisDist(x,xbar)
problem formulation => choice of los/ risk
purpose of the model => problem formulation
Identification
natural sciences, economics, medicine, some engineering
Prediction/Generalize
statistic/ machine learning, comple phenomenon, general applications
M
logistic regression, support vector machine, random forest
from sklearn.linear_model import LogisticRegression from sklearn.svm import SVC from sklearn.ensemble import RandomForestClassifier def init_models(X_train, y_train): models = [LogisticRegression(), RandomForestClassifier(), SVC(probability=True)] for model in models: model.fit(X_train, y_train) return models models = init_models(X_train, y_train)
Learning Curves
Plot of the model performance:
The Risk or Cost or Score vs.
Size of Training Set and Test Set
Classifiers: Score or l- Score
Non-Parametric Models: KDEs
Derived Feature: x = |f0 – f1|/f0
Definition: the ratio of the submitted charge to the difference between the submitted charge and payment amount by medicare.
x = abs(f0-f1)/f0 n0, bins0, patches0=plt.hist(x,100,normed=0,range=(0,1),histtype='stepfilled') plt.setp(patches0, 'facecolor','g','alpha', 0.75) from scipy import stats from functools import partial def my_kde_bandwidth(obj, fac=1./5): """We use Scott's Rule, multiplied by a constant factor.""" return np.power(obj.n, -1./(obj.d+4)) * fac def getKDE(data, name="", bwfac = 0.2): x2 = data x_eval = np.linspace(x2.min() - 1, x2.max() + 1, 500) kde = stats.gaussian_kde(x2, bw_method=partial(my_kde_bandwidth, fac=bwfac)) fig1 = plt.figure(figsize=(8.6)) ax = fig1.add_subplot(111) plt.yscale=('log') plt.grid(True) x2h1, x2h2 = np.histogramix.bins=[0.,0.1,0.2,0.3,0.4,0.5,0.6,0.7,0.8,0.9,1.0],normed ax.plot(x2, np.zeros(x2.shape), 'b+', ms=12)