วันศุกร์ที่ 11 ตุลาคม พ.ศ. 2567

PointCloud

In 3D modeling, a point cloud is a set of data points in a 3D coordinate system—commonly known as the XYZ axes.

https://en.wikipedia.org/wiki/Point_cloud

Geospatial DBMS

https://postgis.net/

PostGIS extends the capabilities of the PostgreSQL relational database by adding support for storing, indexing, and querying geospatial data.

Retrieval Augmented Generation (RAG) for GAI

 https://www.gai.in.th/prompting-techniques/retrieval-augmented-generation-rag

วันพุธที่ 9 ตุลาคม พ.ศ. 2567

ChatGPT vs Gemini

 From my experience, ChatGPT is good at linguistic tasks but math while Gemini is opposite.

Forecast error metrics: sMAPE & MASE & NMAE & NMSE for cross data set comparison

  • เศษส่วนเรียกว่า Fraction; เศษ เรียกว่า Numerator; ส่วน เรียกว่า Denominator

Mean Absolute Percentage Error (MAPE)

  • The formula is:

    MAPE=1nt=1n(ytyt^yt)×100\text{MAPE} = \frac{1}{n} \sum_{t=1}^{n} \left( \frac{|y_t - \hat{y_t}|}{|y_t|} \right) \times 100

    Where:

    • yty_t is the actual value at time tt.
    • yt^\hat{y_t} is the forecasted (predicted) value at time tt.
    • nn is the total number of observations.
    • MAPE expresses the error as a percentage of the actual values and may exceed 100 percent.
    • Lower MAPE means better forecasting accuracy.
    • Higher MAPE indicates larger errors.
Symmetric Mean Absolute Percentage Error (sMAPE) 
  • Another popular metric for evaluating the accuracy of forecasting models. It is a modified version of the Mean Absolute Percentage Error (MAPE) that addresses some of MAPE's limitations, particularly when the actual values are close to zero, which can lead to inflated percentage errors in MAPE.
  • The formula for sMAPE is:

    sMAPE=1nt=1nytyt^yt+yt^2×100\text{sMAPE} = \frac{1}{n} \sum_{t=1}^{n} \frac{|y_t - \hat{y_t}|}{\frac{|y_t| + |\hat{y_t}|}{2}} \times 100

    Where:

    • yty_t is the actual value at time tt.
    • yt^\hat{y_t} is the forecasted value at time tt.
    • nn is the number of data points.
  • It is considered symmetric because it treats overestimation and underestimation equally:
    • Absolute Difference: It calculates the absolute difference between the forecast and the actual value for each data point. This ensures that both overestimations (positive differences) and underestimations (negative differences) are treated as positive values.
    • Sum of Actual and Forecast: In the denominator, it sums the absolute values of the actual and forecast values. This ensures that the denominator is always positive and symmetric, regardless of whether the forecast is over or underestimating the actual value.
  • IMHO, it's difficult to interpret sMAPE because its denominator includes errorneous forecast values as well.
Mean Absolute Scaled Error (MASE)
  • MASE is calculated as the ratio of the mean absolute error of the forecasting model to the mean absolute error of a naive forecasting model. A "naive" model, in this context, refers to a model that simply uses the previous value as the forecast value for the next time period (e.g., for time series data) i.e. เอาค่าจริงที่ t-1 มาเป็นค่า forecast ที่ t.

    The formula for MASE is:

    MASE=1nt=1nytyt^1n1t=2nytyt1∣​

    Where:

    • yty_t is the actual observed value at time tt
    • yt^\hat{y_t} is the forecasted value at time tt
    • nn is the number of observations
    • The denominator is the mean absolute error of a naive forecasting algorithm (often the "random walk" method, which uses the previous period’s value as the forecast).

    Interpretation:

    • MASE = 1: The model performs as well as the naive forecast.
    • MASE < 1: The model outperforms the naive forecast (i.e., it produces lower errors).
    • MASE > 1: The model underperforms compared to the naive forecast.
  • Scale independence: MASE can be used for comparison purpose across different datasets with varying scales since MASE itself has no unit.
  • IMHO, MASE aims at comparing the proposed forecasting algorithm with the (in-sample one-step) naive algorithm.
  • NMAE and NMSE are also scale independent but aim at quantifying the forecast errors in relation to the actual values. NMAE and NMSE are just MAE and MSE divided by one of the following normalizers:
    • Range: The difference between the maximum and minimum values of the actual data (max(yt)min(yt)\text{max}(y_t) - \text{min}(y_t)).
    • Mean: The mean of the actual values (yˉ\bar{y}).
    • Median: Sometimes the median of the actual values is used.
Cf. Gemini, ChatGPT, Wikipedia

วันเสาร์ที่ 5 ตุลาคม พ.ศ. 2567

Java's key advantages over Python

 1. Type Safety & Reliability

- Static typing catches errors at compile-time rather than run time error as in Python 

- Stronger type checking

- Less runtime surprises

- Better for large codebases

- Clearer code contracts

2. Performance

- Faster execution speed

- True multithreading (no GIL)

- Better memory management

- More efficient for CPU-intensive tasks

- Better scalability

3. Enterprise Features

- Robust frameworks (Spring)

- Better security features

- Strong enterprise tooling

- Better transaction management

- Industry-standard enterprise solutions

4. Team Development

- Easier to maintain in large teams

- Better code organization

- Clearer package structure

- Enhanced refactoring capabilities

- Better for modular development

5. Tools & IDE Support

- Superior debugging tools

- Better code analysis

- More sophisticated IDEs

- Better profiling tools

- Comprehensive development environments

6. Stability & Maintenance

- Better backward compatibility

- Longer support cycles

- More stable ecosystem

- Clearer deprecation paths

- Better for long-term projects

7. Security

- Built-in security manager

- Better access control

- Enterprise-grade security

- More secure by design

- Better authentication/authorization

8. Documentation & Standards

- More standardized practices

- Better documentation

- Clearer coding standards

- Industry-wide best practices

- More consistent coding patterns

This makes Java particularly suitable for:

- Enterprise applications

- Large-scale systems

- Mission-critical software

- Long-term projects

- Team-based development

While Python excels in:

- Rapid prototyping

- Data science

- Script automation

- Small to medium projects

- Quick development cycles


วันศุกร์ที่ 4 ตุลาคม พ.ศ. 2567

Python is not for enterprise applications.

Because it lacks extensibility and maintainability unlike Java language.