Giter VIP home page Giter VIP logo

analisis-numerico-computo-cientifico's Introduction

Optimización

En este repositorio encuentran el contenido para los cursos de optimización* (aka opt) y optimización avanzada* (aka opt2) impartida en la maestría de ciencia de datos del ITAM por los prof. Erick Palacios Moreno, github: palmoreck y J. Ezequiel Soto S., github: cheque.

*El curso de optimización se imparte en agosto-diciembre y el de optimización avanzada en enero-mayo.

Se ha creado el siguiente libro* con el contenido de los temas en libro de optimización para su consulta. Este libro seguiremos a lo largo de los cursos.

*El libro fue creado con jupyter book.

En temario-opt encuentran el temario de optimización.

En pres-opt encuentran una presentación de introducción al curso de optimización 2022.

Dar click en el siguiente botón para unirse* al chat del curso de optimización 2022 en gitter: Gitter

*Se puede hacer el registro con su cuenta de github.


Optimización avanzada

En temario-opt-2 encuentran el temario de optimización avanzada.

En opt se obtiene documentación de un paquete de Python que sirve de apoyo para los ejemplos de las notas.

En pres-opt-2 encuentran una presentación de introducción al curso de optimización avanzada 2021.

Dentro del directorio deployments/minikube/hostpath_pv/ encontrarán archivos de configuración .yaml para despliegue de servicios y pipelines usando minikube, kubeflow y kale.


Imágenes de Docker creadas

Curso Imagen
Optimización palmoreck/jupyterlab_optimizacion:3.4.3
Optimización avanzada palmoreck/jupyterlab_optimizacion_2:3.4.3

Una vez hayan instalado docker* en sus computadoras, al inicio de cada nota del libro se indica el comando docker run para correr los contenedores. O bien pueden correrlos de acuerdo a la documentación de la imagen, ver por ejemplo running optimizacion docker image in a docker container, running optimizacion_2 docker image in a docker container .

*Ver herramientas/docker/ para referencias de docker.

Organización de github classroom para optimización 2022

La organización optimizacion-2022-gh-classroom fue creada para alojar sus repositorios de github classroom en los que entregarán sus prácticas. Ver github education como una referencia.

Ramas del repositorio.

Se tienen diferentes ramas que pueden ser accesadas como se aprecia en esta imagen:

imagen

Seleccionar por ejemplo la rama optimizacion-2021 (u otra) para información del curso de Optimización de 2021.

Dar click en optimizacion-2022 para la rama del curso de optimización 2022.

La rama gh-pages contiene los htmls para visualización del libro de optimización.

Breve explicación del repositorio en la rama main y su wiki.

En el Wiki encuentran información sobre Amazon Web Services.

En el directorio libro_optimizacion/temas/ están las notas escritas.

Sobre las notas.

Las notas de cada tema están escritas en Jupyter notebooks. Ver I python, You R, We Julia para algunas características de tales notebooks. Ver notebook para funcionalidad de los notebooks. Ver Jupyter kernels para una tabla de los jupyter-kernels disponibles en jupyter (que hacen posible ejecutar instrucciones en el lenguaje R, por ejemplo).

Interactividad

Para ejecutar las notas de forma interactiva dar click en el botón de binder Binder o bien dentro del libro de optimización colocarse sobre el ícono 🚀

binder_thebe_screenshot_jupyter_book

y elegir una ejecución interactiva de los notebooks vía binder* o thebe. La ejecución con thebe se puede hacer directamente en la liga del libro o si se descargan los archivos a su máquina local también es posible la ejecución (pero requieren conexión a internet en cualquier opción).

*En la liga jupyterhub/binderhub encuentran más información sobre binder.

Para convertir notas a pdf

Usar el siguiente botón de binder (no es el mismo botón que para interactividad) Binder

Abrir una nueva terminal y ejecutar lo siguiente si se desean convertir las notas a pdf capítulo por capítulo de su elección.

#bash build_chapter.sh <aquí colocar cuál capítulo 1, 2, 3, 4, 5>
#por ejemplo: 
bash build_chapter.sh 3
#Una vez que finalice el comando anterior se puede ejecutar por ejemplo:
bash build_chapter.sh 1

Alternativamente si se desean los capítulos del 1 al 3 por ejemplo ejecutar lo siguiente.

bash build_all_chapters.sh 3
#del capítulo 1 al capítulo 5
bash build_all_chapters.sh 5

Los pdf's estarán dentro del directorio analisis-numerico-computo-cientifico/libro_optimizacion/temas/_build/pdf. Y se pueden descargar:

imagen

imagen

Para descargar notas en html dentro de un zip

Usar botón de binder Binder

Abrir una nueva terminal y ejecutar lo siguiente:

bash
cd analisis-numerico-computo-cientifico/libro_optimizacion/temas/
jb build .
zip -r book.zip _build/html

El zip estará dentro del directorio analisis-numerico-computo-cientifico/libro_optimizacion/temas/. Y se puede descargar:

imagen

imagen

Una vez descargado abrir el archivo README.html.

Nota: durante el segundo semestre del 2022 se estarán haciendo cambios continuamente por lo que tendrán que actualizar su descarga, clon o fork.

analisis-numerico-computo-cientifico's People

Contributors

amaurs avatar arianalopez avatar ca-mi-lo avatar csampez avatar dfceron avatar fernandatellezg avatar gmontanari avatar gquirozm avatar hatshex avatar isabelmillan avatar ixime avatar jccastrom avatar lizcontreras avatar marianaga89 avatar marz7002 avatar maximilianoar avatar mcarmonabaez avatar mjgq avatar mleblanc03 avatar monicabc avatar ollin18 avatar omisimo avatar oscardaniel88 avatar palmoreck avatar radianv avatar raulzr avatar ricardolastra avatar songeo avatar visagu55 avatar walterms avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

analisis-numerico-computo-cientifico's Issues

Change definition of arreglo_2d for handling of 2-d arrays

This definition of arreglo_2d needs that m is defined somewhere in the code:

//arreglo2d:
typedef struct{
int m, n;
#define renglones(arreglo) ((arreglo)->m)
#define columnas(arreglo) ((arreglo)->n)
double *arr;
#define entradas(arreglo) ((arreglo)->arr)
#define entrada(arreglo,i,j) ((arreglo)->arr[j*m+i]) //almacenamos column major
}arreglo_2d;
typedef arreglo_2d *arreglo_2d_T;

Snippet from:
https://github.com/ITAM-DS/analisis-numerico-computo-cientifico/tree/master/C/BLAS/ejemplos
https://github.com/ITAM-DS/analisis-numerico-computo-cientifico/tree/master/C/LAPACK/ejemplos
https://github.com/ITAM-DS/analisis-numerico-computo-cientifico/tree/master/C/extensiones_a_C/MPI/openMPI/ejemplos/3_openMPI_y_BLAS

To avoid this define arreglo_2d as:

//arreglo2d:
typedef struct{
int m, n;
#define renglones(arreglo) ((arreglo)->m)
#define columnas(arreglo) ((arreglo)->n)
double *arr;
#define entradas(arreglo) ((arreglo)->arr)
#define entrada(arreglo,i,j) ((arreglo)->arr[j*renglones(arreglo)+i]) //almacenamos column major
}arreglo_2d;
typedef arreglo_2d *arreglo_2d_T;

So I have to run examples of BLAS, LAPACK and BLAS-OPENMPI to check everything is ok¡

make README intro more newbie friendly

Suggestions:

  • Start mentioning this is the repo of the course X at ITAM by Erick Palacios

  • Link to Temario should be larger and should be at the beginning.

  • Explain how to select a branch with an image like this:

imagen

  • Add Author to notes in dropbox

  • Add "Índice de notas" as a title before the notes, otherwise the intuitive thing is to think that is a Temario and the difference ain't clear.

Issue on order of trapezoidal rule

Your issue content here

The text states in the chapter Expresiones de los errores para las reglas compuestas del rectángulo, trapecio y Simpson that the Trapezoidal rule is $\bigO(h^2)$ when in reality is $\bigO(h^3)$

Example of parallel computing for ecology connectivity

Circuitscape borrows algorithms from electronic circuit theory to predict connectivity in heterogeneous landscapes. Landscapes are represented as conductive surfaces, with low resistances assigned to landscape features types that are most permeable to movement or best promote gene flow, and high resistances assigned to movement barriers. Effective resistances, current flow, and voltages calculated across the landscapes can then be related to ecological processes, such as individual movement and gene flow. More detail about the underlying model, its parameterization, and potential applications in ecology, evolution, and conservation planning can be found in McRae (2006) and McRae et al. (2008).

Circuitscape was originally designed to analyze connectivity across raster grids. With version 4.0, it can now analyze arbitrary networks (graphs) with any set of connections between nodes the user specifies.

It was written in python, but due to computational constrains they are developing a new version in julia. Could be a cool example.

https://circuitscape.org/

https://github.com/Circuitscape/Circuitscape.jl

add profilers, debuggers to codes

Use

  • for bash:
/usr/bin/time --verbose 
perf stat -e cycles,stalled-cycles-frontend,stalled-cycles-backend,instructions,\
cache-references,cache-misses,branches,branch-misses,task-clock,faults,\
minor-faults,cs,migrations -r 3
  • for Python:
#cProfile:
python -m cProfile -s cumulative
python -m cProfile -o profile.stats
pip install runsnake
#lineprofiler:
pip install line_profiler
kernprof.py -l -v
#memoryprofiler:
pip install memory_profiler
pip install psutil
python -m memory_profiler
#magic commands:
%memit
%timeit
#heapy
pip install guppy
  • for C: gdb, valgrind

  • for R: lineprof, profvis

  • for cuda: cuda-gdb

Check some references

Julia, CVXPy, Jupyter notebooks examples:

http://www.juliaopt.org/Convex.jl/stable/examples/portfolio_optimization/portfolio_optimization2/

https://colab.research.google.com/github/cvxpy/cvxpy/blob/master/examples/notebooks/WWW/mTSP_en.ipynb

https://www.cvxpy.org/examples/basic/linear_program.html
https://www.cvxpy.org/examples/applications/MM.html?highlight=multiply

https://github.com/cvxgrp/pymde/tree/main/examples
https://github.com/cvxgrp/pymde
https://github.com/cvxgrp/cvx_short_course/blob/master/exercises/13.20.ipynb
https://github.com/cvxgrp/cvx_short_course/blob/master/exercises/Lasso.ipynb

https://www.cvxpy.org/examples/applications/tv_inpainting.html

https://nbviewer.jupyter.org/github/cvxgrp/cvxpy/blob/master/examples/notebooks/WWW/tv_inpainting.ipynb

https://stackoverflow.com/questions/22937589/how-to-add-noise-gaussian-salt-and-pepper-etc-to-image-in-python-with-opencv

https://stanford.edu/~boyd/papers/cvx_short_course.html

https://nbviewer.jupyter.org/github/cvxgrp/cvx_short_course/blob/master/applications/portfolio_optimization.ipynb

https://nbviewer.jupyter.org/github/cvxgrp/cvx_short_course/blob/master/intro/SVM.ipynb

https://github.com/cvxgrp

https://www.cvxpy.org/tutorial/dcp/index.html?highlight=norm

https://www.cvxpy.org/examples/index.html#basic

https://www.cvxpy.org/examples/basic/least_squares.html

https://colab.research.google.com/github/cvxgrp/cvx_short_course/blob/master/applications/model_fitting.ipynb

Kubernetes

https://www.katacoda.com/courses/kubernetes/playground

https://kubernetes.io/es/docs/tutorials/kubernetes-basics/create-cluster/cluster-interactive/

https://kubernetes.io/es/docs/tutorials/hello-minikube/

Newtons method for infeasible initial points regarding cieco problems

Convex inequality and equality optimization problems were almost finished. See:

algorithms for cieco

and:

Feasible initial point

But for the infeasible initial point, need to fix some errors (execute 2nd example using [-4,-4] as x_0):

Infeasible initial point

which is using: algoritmos/Python dir.

Examples of tests for this case of infeasible inital point are in:

Infeasible inital point 1st version

Infeasible inital point 2nd version

Need to check which one is going to be the one that I will use.... 1st or 2nd version....

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.