This is a simple elasticsearch scala config.
Add the following dependency:
"com.sksamuel.elastic4s" %% "elastic4s-http" % "6.5.1"
Create the pemfile using aws-cli:
$ aws ec2 create-key-pair --key-name rodrigo-hernandez-mota-ds-dev --query 'KeyMaterial' --output text --region us-west-2 --profile ds-dev > rodrigo-hernandez-mota-ds-dev.pem
$ chmod 400 rodrigo-hernandez-mota-ds-dev.pem
Create the pemfile using aws-cli:
$ aws ec2 create-key-pair --key-name rodrigo-hernandez-mota-ds-dev --query 'KeyMaterial' --output text --region us-west-2 --profile ds-dev > rodrigo-hernandez-mota-ds-dev.pem
$ chmod 400 rodrigo-hernandez-mota-ds-dev.pem
The enrollment-database contains data resembling the following:
student
id | first_name | last_name | gender | gpa | age |
---|---|---|---|---|---|
1 | Amelia | O'Sullivan | female | 3.7 | 20 |
2 | Rachel | Stevens | female | 3.5 | 25 |
3 | Sarah | Dunn | female | 3.2 | 23 |
4 | Liam | Baker | male | 3.3 | 24 |
FROM python:3.7-alpine3.9 | |
ENV PYTHONBUFFERED 1 | |
RUN apk add --update --no-cache --virtual .build-deps \ | |
ca-certificates gcc postgresql-dev python3-dev linux-headers musl-dev \ | |
libffi-dev jpeg-dev zlib-dev g++ mariadb-dev | |
RUN mkdir /code | |
WORKDIR /code |
import jax.numpy as np | |
def irr(cashflows): | |
res = np.roots(cashflows[::-1]) | |
mask = (res.imag == 0) & (res.real > 0) | |
# Filter out imaginary component. | |
if not mask.any(): | |
return np.nan | |
res = res[mask].real |
{ | |
"ASYNC-PROCESS": 2.6283581256866455, | |
"ASYNC-THREAD": 11.003680944442749, | |
"SYNC": 10.771448135375977 | |
} |
import numpy as np | |
def irr(cashflows): | |
# Get polynomial roots | |
res = np.roots(cashflows[::-1]) | |
# Filter out imaginary component. | |
mask = (res.imag == 0) & (res.real > 0) | |
if not mask.any: | |
return np.nan |