semvec/pypi-packages huggingface dataset:
Selection-Method 0.0.3
For selecting the optimal features using the stepwise algorithm
Keywords: feature-selection, selection-methods, forward-stepwise, backward-stepwise, stepwise-selection, Dubem

# Selection Method

### Purpose of the Package
+ Selection Method is a Python module which implements a statistical learning method for selecting features (for predicting a target variable) in a given dataset.

### Features
+ Collection of Feature Selection Methods
    - Forward Stepwise
    - Backward Stepwise

### Getting Started
The package can be found on pypi hence you can install it using pip

### Installation
```bash
pip install Selection_Method 
```

### Usage
Forward_Stepwise
```python
>>> from Selection_Method.Forward_Stepwise import forward_stepwise
>>>
>>> #initialize forward_stepwise object, and your already created regression model object.
>>> selection = forward_stepwise(linear_model)
>>>
>>> #input your already split train and test datasets into the .select_features() method, and select the optimal features using the stepwise algorithm.
>>> final_list, final_score = selection.select_features(x_train, x_test, y_train, y_test)
```

### Example
```python
>>> import pandas as pd
>>> from sklearn.linear_model import LinearRegression
>>> from Selection_Method.Forward_Stepwise import forward_stepwise
>>>
>>> #define your linear regression object
>>> linear_model = LinearRegression()
>>>
>>> #import your preferred dataset
>>> crime_xtrain = pd.read_csv('x_train.csv')
>>> crime_xtest = pd.read_csv('x_test.csv')
>>> crime_ytrain = pd.read_csv('y_train.csv')
>>> crime_ytest = pd.read_csv('y_test.csv')
>>>
>>> #initialize forward_stepwise object
>>> selection = forward_stepwise(linear_model) 
>>>
>>> #input your train and test dataset into the .select_features() method and execute.
>>> final_list, final_score = selection.select_features(x_train, x_test, y_train, y_test)
>>> print(forward_list, f_score)
['pctKids2Par', 'pctWhite', 'houseVacant', 'State', 'pctUrban', 'pctWorkMom18', 'persPoverty', 'pctRetire', 'pct1624', 'pctEmployMfg', 'ownHousLowQ', 'pct2Par', 'medOwnCostPctWO', 'numForeignBorn', 'medRentpctHousInc', 'pctEmploy', 'pctWwage', 'pctHousWOplumb', 'pctSameState5', 'otherPerCap', 'pctHousWOphone', 'pctPoverty', 'persPerOccupHous', 'persPerOwnOccup', 'persPerFam', 'rentMed', 'persHomeless', 'NAperCap'] 0.6315059907414283
```

### Contribution
This Project is open to contribution and collaboration. 
Feel free to connect.

### Author
+ Main Maintainer: Michael Dubem Igbomezie
fwponitor 0.0.1
monitor the fw
Requires Python: >=3.6

# IPMonitor

`ipmonitor` can be used to grok `IPTABLES`, `UFW` or any program that logs similar to `IPTABLES`, logs from your `syslog` (_active_) or a gathered log/text file (_passive_) in a comprehensive format in order to conduct network traffic analysis and security audit of your servers.

## Demo

[![asciicast](https://asciinema.org/a/394593.svg)](https://asciinema.org/a/394593)

## Usage

Clone this repository:

```bash
git clone https://github.com/pouriyajamshidi/fwmonitor.git
```

Make the script executable:

```bash
chmod +x fwmonitor.py
```

For your convenience, you can place the program in your system PATH, like `/bin/` or `/usr/local/bin/` for instance:

```bash
sudo cp fwmonitor.py /usr/local/bin/fwmonitor
```

This script takes 4 optional arguments. These arguments are:

**`--file`**: Location of log file to be scanned. Default location is **/var/log/syslog**

**`--key`** : Keyword that `IPTABLES` uses to log events. Make sure of case-sensitivity and specific keyword in your log file. Default value for keyword is **"UFW BLOCK"**

**`--interval`**: Interval to read the log file from scratch, this is useful for analyzing a live system. If you pass `0` here, it'll scan the log file once and exits. Default value for interval is **60 seconds**

**`--ipv6`**: Display `IPv6` logs. Default is **IPv4**

_By running the script without providing any arguments, the default values as mentioned below above be used._

```python
./fwmonitor.py
```

## Examples

To analyze a log file that you have gathered:

```python
python3 fwmonitor.py --file mytraffic.log --key "IPTABLES_BLOCK" --interval 0
```

Audit a live server:

```python
python3 fwmonitor.py --file /var/log/syslog --key "IPTABLES_BLOCK"
```

Additionally, there is a `sample.log` in this repository that you can utilize to see how this script works without actually having a log file yourself. Use it like:

```bash
python3 fwmonitor.py --file sample.log --key "UFW BLOCK" --interval 0
```

## Tested on

Ubuntu.

_It can be used on `Windows` and `Mac OS` as well to analyze the gathered log file(s)._

## TODO

- [x] IGMP support
- [ ] Implement smart spacing
- [ ] IPv6 support

## Contributing

Pull requests are welcome.

## License

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
easy-elasticsearch 0.0.9
An easy-to-use Elasticsearch BM25 interface
Requires Python: >=3.6

# Easy Elasticsearch

This repository contains a high-level encapsulation for using [Elasticsearch](https://www.elastic.co/downloads/elasticsearch) with python in just a few lines.

## Installation
Via pip:
```bash
pip install easy-elasticsearch
```
Via git repo:
```bash
git clone https://github.com/kwang2049/easy-elasticsearch
pip install -e . 
```

## Usage
To utilize the elasticsearch service, one can select from 3 ways:
- (1) Start an ES service manually and then indicate the `host` and `port_http` (please refere to [download_and_run.sh](easy_elasticsearch/examples/download_and_run.sh)); 
- (2) Or leave `host=None` by default to start a docker container itself;
- (3) Or leava `host=None` and setting `service_type=executable` to download an ES executable and start it in the back end.

Finally, just either call its ```rank``` or ```score``` function for retrieval or calculating BM25 scores.
```python
from easy_elasticsearch import ElasticSearchBM25

pool = {
    'id1': 'What is Python? Is it a programming language',
    'id2': 'Which Python version is the best?',
    'id3': 'Using easy-elasticsearch in Python is really convenient!'
}
bm25 = ElasticSearchBM25(pool, port_http='9222', port_tcp='9333')  # By default, when `host=None` and `mode="docker"`, a ES docker container will be started at localhost.

query = "What is Python?"
rank = bm25.query(query, topk=10)  # topk should be <= 10000
scores = bm25.score(query, document_ids=['id2', 'id3'])

print(query, rank, scores)
bm25.delete_index()  # delete the one-trial index named 'one_trial'
bm25.delete_container()  # remove the docker container'
```
Another example for retrieving Quora questions can be found in [easy_elasticsearch/examples/quora.py](easy_elasticsearch/examples/quora.py):
```bash
python -m easy_elasticsearch.examples.quora  --mode docker
```
or
```bash
python -m easy_elasticsearch.examples.quora  --mode executable
```
xlsxdocument 1.3.10
Easily create XLSX documents with Django

============
XLSXDocument
============

This is a wrapper for openpyxl_ which makes creating XLSX documents with
the purpose of exporting data less boring::

    from xlsxdocument import XLSXDocument

    def xlsx_export(request):
        some_data = Bla.objects.all()

        xlsx = XLSXDocument()
        xlsx.table_from_queryset(Bla.objects.all())
        return xlsx.to_response('bla.xlsx')


Adding in additional cells at the end is also possible::

    xlsx = XLSXDocument()
    xlsx.table_from_queryset(
        Bla.objects.all(),
        additional=[(
            'Full URL',
            lambda instance: 'http://example.com%s' % (
                instance.get_absolute_url(),
            ),
        )],
    )


You can also easily add the facility to export rows to Django's
administration interface::

    from django.contrib import admin
    from django.utils.translation import gettext_lazy as _

    from xlsxdocument import export_selected

    from app import models


    class AttendanceAdmin(admin.ModelAdmin):
        list_filter = ('event',)
        actions = (export_selected,)


    admin.site.register(models.Event)
    admin.site.register(models.Attendance, AttendanceAdmin)


If you require additional columns with ``export_selected`` use this
snippet instead::

    from xlsxdocument import create_export_selected

    class AttendanceAdmin(...):
        actions = [
            create_export_selected(
                additional=[
                    # ... see above
                ]
            )
        ]


.. _openpyxl: https://openpyxl.readthedocs.io/
csa-abcLR 1.0.2
CSA-ABC-LR is a classification method that combines The CSA and The ABC algorithm with a logistic regression classification model

# CLONAL SELECTION ALGORITHM AND ARTIFICIAL BEE COLONY ALGORITHM WITH LOGISTIC REGRESSION (CSA-ABC-LR)

CSA-ABC-LR is a binary classification method in which the ABC algorithm is used instead of the Gradient Descent algorithm to train the weights in the Logistic Regression classification model. The purpose of the CSA-ABC algorithm in the CSA-ABC-LR method is to minimize the value of the cost function. The ABC algorithm is a very popular metaheuristic method that can search for solutions both locally and globally in the solution space. In addition, it has been shown in the study that the CSA-ABC-LR classification method achieves superior classification success compared to the LR classification method.

Although the ABC-LR classification method can handle complex and high-dimensional data, its runtime can be high. Therefore, CPU and GPU parallelized versions of the ABC-LR classification method are presented here, and significant improvements in runtime can be achieved.

ABC-LR is written in Python3 and continuously tested with Python 3.7 and 3.10.

## Installation

Install ABC-LR via PyPI:

```
pip install csa_abc_lr
```

Or alternatively, clone the environment:

```
git clone https://github.com/kagandedeturk/CSA-ABC-LR.git
```

## CPU Version Usage

```py

import numpy as np
parallelType = np
from abcLR import ABC_LR_Model
from sklearn.datasets import load_breast_cancer
X, y = load_breast_cancer(return_X_y=True)
y = y.reshape(-1,1)

lb = -16
ub = 16
evaluationNumber = 80000
# FVS = trainData.shape[1]
limit = 50
P = 60
MR = 0.3
L2 = 0

model = ABC_LR_Model(lb=lb, ub=ub, evaluationNumber=evaluationNumber, limit=limit, P=P, MR=MR, L2=L2, parallelType=parallelType)
#start_time = dt.datetime.now()
model.fit(X, y)
#print(f"Run time: {dt.datetime.now()-start_time}")
print(f"Result: {model.score(X, y)}")

```

## GPU Version Usage

```py
import cupy as cp
parallelType = cp
from abcLR import ABC_LR_Model
from sklearn.datasets import load_breast_cancer
X, y = load_breast_cancer(return_X_y=True)

X = parallelType.array(X)
y = parallelType.array(y.reshape(-1,1))

lb = -16
ub = 16
evaluationNumber = 80000
# FVS = trainData.shape[1]
limit = 50
P = 60
MR = 0.3
L2 = 0

model = ABC_LR_Model(lb=lb, ub=ub, evaluationNumber=evaluationNumber, limit=limit, P=P, MR=MR, L2=L2, parallelType=parallelType)
#start_time = dt.datetime.now()
model.fit(X, y)
#print(f"Run time: {dt.datetime.now()-start_time}")
print(f"Result: {model.score(X, y)}")

```

## License

This program is free software: you can redistribute it and/or modify
it under the terms of the 3-clause BSD license (please see the LICENSE file).

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

You should have received a copy of the 3-clause BSD license
along with this program (see LICENSE file).
If not, see [here](https://opensource.org/licenses/BSD-3-Clause).

Copyright (c) 2022, Bilge Kagan Dedeturk (kagandedeturk@gmail.com)