{% extends "layout.html" %}
{% set title = 'skrub: Machine Learning for dataframes' %}

{%- block extrahead %}
    {{ super() }}
    {# Add here landing-page specific stuff that goes in the header (eg css) #}
{%- endblock extrahead %}

{% block docs_navbar %}
    {{ super() }}

    {# We add the full-width banner below the navbar, as the div there is
still full-width (unlike the article) #}
<div class="container-fluid sk-landing-bg">
  <div class="container sk-landing-container">
    <div class="row">
      <div class="col-md-4 d-flex align-items-center">
          <h1 class="sk-landing-header text-white text-monospace">skrub</h1>
      </div>
      <div class="col-md-8">
        <ul class="sk-landing-header-body">
          <li>scikit-learn compatible</li>
          <li>Database preprocessing</li>
          <li>Heterogeneous Pandas and Polars dataframes (numeric, categorical, dates, text...)</li>
        </ul>
      </div>
    </div>
  </div>
</div>
{% endblock docs_navbar %}

{% block docs_main %}
<div class="container-fluid sk-landing-container">
  <div class="row row-padding-main-container">
    <h1 class="hero-title">Machine learning for dataframes</h1>
    <p class="hero-description"><code>skrub</code> is a Python library to
      ease preprocessing and feature engineering for
      <strong>tabular machine learning</strong>.
      <br />
      Our long-term goal is to directly connect database tables to machine learning estimators.
    </p>
    <div class="text-center mt-4">
        <a class="btn sk-btn-orange mb-1 d-inline-block" href="{{ pathto('auto_examples/00_getting_started') }}" role="button">Get started →</a>
    </div>
  </div>

  <!-- Feature Section 1 -->
  <div class="row mb-0 row-padding-between-features">
    <div class="col-md-5 mb-5">
      <h4 class="feature-title">Effortless Pipelines</h4>
      <p class="feature-text">Create strong scikit-learn pipeline baselines effortlessly with
        <a class="reference internal"
        href="reference/generated/skrub.TableVectorizer.html#tablevectorizer"
        title="skrub.TableVectorizer"><code class="xref py py-class docutils
        literal notranslate sk-landing-code"><span class="pre">TableVectorizer</span></code></a>
        and
        <a class="reference internal"
        href="reference/generated/skrub.tabular_learner.html#skrub.tabular_learner"
        title="skrub.tabular_learner"><code class="xref py py-class docutils
        literal notranslate"><span class="pre">tabular_learner</span></code></a>.
      </p>
    </div>


    <div class="col-md-7">
      <!-- Placeholder for coding demo -->
      {% include "demo_tabular_learner.html" %}

    </div>
  </div>

  <!-- Feature Section 2 -->
  <div class="row mb-0 flex-md-row-reverse row-padding-between-features">
    <div class="col-md-5">
      <h4 class="feature-title">Powerful Feature Engineering</h4>
      <p class="feature-text">Encode text and high cardinality categorical data with the
        <a class="reference internal"
        href="reference/generated/skrub.GapEncoder.html#gapencoder"
        title="skrub.GapEncoder"><code class="xref py py-class docutils
        literal notranslate"><span class="pre">GapEncoder</span></code></a>
        and
        <a class="reference internal"
        href="reference/generated/skrub.MinHashEncoder.html#minhashencoder"
        title="skrub.MinHashEncoder"><code class="xref py py-class docutils
        literal notranslate"><span class="pre">MinHashEncoder</span></code></a>, and
        extract features from dates with the
        <a class="reference internal"
        href="reference/generated/skrub.DatetimeEncoder.html#datetimeencoder"
        title="skrub.DatetimeEncoder"><code class="xref py py-class docutils
        literal notranslate"><span class="pre">DatetimeEncoder</span></code></a>.
      </p>
      {% include "demo_gap_encoder.html" %}
    </div>
    <div class="col-md-7 pe-5">
      <div class="encoding-image"></div>
    </div>
  </div>

  <!-- Feature Section 3 -->
  <div class="row mb-0 row-padding-between-features">
    <div class="col-md-5">
      <h4 class="feature-title">Interactive Data Exploration</h4>
      <p class="feature-text">Explore your dataframes interactively with
        <a class="reference internal"
        href="reference/generated/skrub.TableReport.html#tablereport"
        title="skrub.TableReport"><code class="xref py py-class docutils
        literal notranslate"><span class="pre">TableReport</span></code></a>.
      </p>
      {% include "demo_table_report_code.html" %}
      <p class="feature-text-see-also">
        <a href="https://skrub-data.org/skrub-reports/">Try it on your dataset →</a>
      </p>
      <div class="row">
        <p class="click-table-report-hint">Click anywhere on the table <i class="fa-solid fa-arrow-trend-down"></i> </p>
      </div>
    </div>
    <div class="col-md-7">
      {% include "demo_table_report_generated.html" %}
    </div>
  </div>

  <div class="row mt-5 flex-md-row-reverse row-padding-between-features">
    <div class="col-md-4 mb-4">
      <h4 class="feature-title">Our Community</h4>
      <p class="feature-text">
        The Skrub project is powered by the efforts of a world-wide community of contributors.
        Here we display a randomly selected group of 30 contributors.
      </p>
    </div>
    <div class="col-md-8">
        <div class="contributors-list" id="contributors-list">
        <!-- Contributors will be dynamically added here -->
        </div>
    </div>
  </div>

  <div class="row mb-0 row-padding-between-features">
    <h1 class="hero-title">Try it yourself!</h1>
    <p class="hero-description">
      Ready to write less code and get more insights? Dive into <code>skrub</code> now
      and be part of an emerging community!
    </p>
    <div class="text-center mt-4">
        <a class="btn sk-btn-orange mb-1 d-inline-block" href="{{ pathto('auto_examples/00_getting_started') }}" role="button">Get started →</a>
    </div>
  </div>
</div>

<script>

function shuffleArray(array) {
    for (let i = array.length - 1; i > 0; i--) {
        const j = Math.floor(Math.random() * (i + 1)); // random index from 0 to i
        [array[i], array[j]] = [array[j], array[i]];  // swap elements
    }
    return array;
}

function selectFirst30(array) {
    // Shuffle the array
    shuffleArray(array);

    // Return the first 30 elements
    return array.slice(0, 30);
}

async function fetchContributors() {
const response = await fetch('https://api.github.com/repos/skrub-data/skrub/contributors?per_page=100');
var contributors = await response.json();
contributors = selectFirst30(contributors)

const contributorsList = document.getElementById('contributors-list');

contributors.forEach(contributor => {
    const contributorElement = document.createElement('div');
    contributorElement.classList.add('contributor');

    contributorElement.innerHTML = `
        <a href="${contributor.html_url}" target="_blank">
            <img src="${contributor.avatar_url}" alt="${contributor.login}">
            <div class="contributor-name">${contributor.login}</div>
        </a>
    `;

    contributorsList.appendChild(contributorElement);
});

// Add "And many more" link as the last element
const andMoreElement = document.createElement('div');
andMoreElement.classList.add('more-contributors');
andMoreElement.innerHTML = `
    <a href="https://github.com/skrub-data/skrub/graphs/contributors" target="_blank">
        And many more →
    </a>
`;
contributorsList.appendChild(andMoreElement);
}

fetchContributors();
</script>


{% endblock docs_main %}

{%- block footer %}

<div class="home-footer">the skrub developers - 2024</div>

{%- endblock footer %}
