SentenceTransformer(
(0): Transformer({'max_seq_length': 512, 'do_lower_case': False}) with Transformer model: BertModel
(1): Pooling({'word_embedding_dimension': 768, 'pooling_mode_cls_token': False, 'pooling_mode_mean_tokens': True, 'pooling_mode_max_tokens': False, 'pooling_mode_mean_sqrt_len_tokens': False, 'pooling_mode_weightedmean_tokens': False, 'pooling_mode_lasttoken': False, 'include_prompt': True})
)pip install -U sentence-transformers1from sentence_transformers import SentenceTransformer
2
3# Download from the 🤗 Hub
4model = SentenceTransformer("lufercho/my-finetuned-sentence-bert")
5# Run inference
6sentences = [
7 'Maximin affinity learning of image segmentation',
8 ' Images can be segmented by first using a classifier to predict an affinity\ngraph that reflects the degree to which image pixels must be grouped together\nand then partitioning the graph to yield a segmentation. Machine learning has\nbeen applied to the affinity classifier to produce affinity graphs that are\ngood in the sense of minimizing edge misclassification rates. However, this\nerror measure is only indirectly related to the quality of segmentations\nproduced by ultimately partitioning the affinity graph. We present the first\nmachine learning algorithm for training a classifier to produce affinity graphs\nthat are good in the sense of producing segmentations that directly minimize\nthe Rand index, a well known segmentation performance measure. The Rand index\nmeasures segmentation performance by quantifying the classification of the\nconnectivity of image pixel pairs after segmentation. By using the simple graph\npartitioning algorithm of finding the connected components of the thresholded\naffinity graph, we are able to train an affinity classifier to directly\nminimize the Rand index of segmentations resulting from the graph partitioning.\nOur learning algorithm corresponds to the learning of maximin affinities\nbetween image pixel pairs, which are predictive of the pixel-pair connectivity.\n',
9 ' Changes in the UK electricity market mean that domestic users will be\nrequired to modify their usage behaviour in order that supplies can be\nmaintained. Clustering allows usage profiles collected at the household level\nto be clustered into groups and assigned a stereotypical profile which can be\nused to target marketing campaigns. Fuzzy C Means clustering extends this by\nallowing each household to be a member of many groups and hence provides the\nopportunity to make personalised offers to the household dependent on their\ndegree of membership of each group. In addition, feedback can be provided on\nhow user\'s changing behaviour is moving them towards more "green" or cost\neffective stereotypical usage.\n',
10]
11embeddings = model.encode(sentences)
12print(embeddings.shape)
13# [3, 768]
14
15# Get the similarity scores for the embeddings
16similarities = model.similarity(embeddings, embeddings)
17print(similarities.shape)
18# [3, 3]sentence_0, sentence_1, and sentence_2| sentence_0 | sentence_1 | sentence_2 | |
|---|---|---|---|
| type | string | string | string |
| details |
|
|
|
| sentence_0 | sentence_1 | sentence_2 |
|---|---|---|
Clustering with Transitive Distance and K-Means Duality | Recent spectral clustering methods are a propular and powerful technique for[object Object]data clustering. These methods need to solve the eigenproblem whose[object Object]computational complexity is $O(n^3)$, where $n$ is the number of data samples.[object Object]In this paper, a non-eigenproblem based clustering method is proposed to deal[object Object]with the clustering problem. Its performance is comparable to the spectral[object Object]clustering algorithms but it is more efficient with computational complexity[object Object]$O(n^2)$. We show that with a transitive distance and an observed property,[object Object]called K-means duality, our algorithm can be used to handle data sets with[object Object]complex cluster shapes, multi-scale clusters, and noise. Moreover, no[object Object]parameters except the number of clusters need to be set in our algorithm.[object Object] | We show that the log-likelihood of several probabilistic graphical models is[object Object]Lipschitz continuous with respect to the lp-norm of the parameters. We discuss[object Object]several implications of Lipschitz parametrization. We present an upper bound of[object Object]the Kullback-Leibler divergence that allows understanding methods that penalize[object Object]the lp-norm of differences of parameters as the minimization of that upper[object Object]bound. The expected log-likelihood is lower bounded by the negative lp-norm,[object Object]which allows understanding the generalization ability of probabilistic models.[object Object]The exponential of the negative lp-norm is involved in the lower bound of the[object Object]Bayes error rate, which shows that it is reasonable to use parameters as[object Object]features in algorithms that rely on metric spaces (e.g. classification,[object Object]dimensionality reduction, clustering). Our results do not rely on specific[object Object]algorithms for learning the structure or parameters. We show preliminary[object Object]results for activity recognition and temporal segmentation.[object Object] |
Clustering Dynamic Web Usage Data | Most classification methods are based on the assumption that data conforms to[object Object]a stationary distribution. The machine learning domain currently suffers from a[object Object]lack of classification techniques that are able to detect the occurrence of a[object Object]change in the underlying data distribution. Ignoring possible changes in the[object Object]underlying concept, also known as concept drift, may degrade the performance of[object Object]the classification model. Often these changes make the model inconsistent and[object Object]regular updatings become necessary. Taking the temporal dimension into account[object Object]during the analysis of Web usage data is a necessity, since the way a site is[object Object]visited may indeed evolve due to modifications in the structure and content of[object Object]the site, or even due to changes in the behavior of certain user groups. One[object Object]solution to this problem, proposed in this article, is to update models using[object Object]summaries obtained by means of an evolutionary approach based on an intelligent[object Object]clustering approach. We carry out various clustering str... | Exponential family extensions of principal component analysis (EPCA) have[object Object]received a considerable amount of attention in recent years, demonstrating the[object Object]growing need for basic modeling tools that do not assume the squared loss or[object Object]Gaussian distribution. We extend the EPCA model toolbox by presenting the first[object Object]exponential family multi-view learning methods of the partial least squares and[object Object]canonical correlation analysis, based on a unified representation of EPCA as[object Object]matrix factorization of the natural parameters of exponential family. The[object Object]models are based on a new family of priors that are generally usable for all[object Object]such factorizations. We also introduce new inference strategies, and[object Object]demonstrate how the methods outperform earlier ones when the Gaussianity[object Object]assumption does not hold.[object Object] |
Trading USDCHF filtered by Gold dynamics via HMM coupling | We devise a USDCHF trading strategy using the dynamics of gold as a filter.[object Object]Our strategy involves modelling both USDCHF and gold using a coupled hidden[object Object]Markov model (CHMM). The observations will be indicators, RSI and CCI, which[object Object]will be used as triggers for our trading signals. Upon decoding the model in[object Object]each iteration, we can get the next most probable state and the next most[object Object]probable observation. Hopefully by taking advantage of intermarket analysis and[object Object]the Markov property implicit in the model, trading with these most probable[object Object]values will produce profitable results.[object Object] | Most existing machine learning classifiers are highly vulnerable to[object Object]adversarial examples. An adversarial example is a sample of input data which[object Object]has been modified very slightly in a way that is intended to cause a machine[object Object]learning classifier to misclassify it. In many cases, these modifications can[object Object]be so subtle that a human observer does not even notice the modification at[object Object]all, yet the classifier still makes a mistake. Adversarial examples pose[object Object]security concerns because they could be used to perform an attack on machine[object Object]learning systems, even if the adversary has no access to the underlying model.[object Object]Up to now, all previous work have assumed a threat model in which the adversary[object Object]can feed data directly into the machine learning classifier. This is not always[object Object]the case for systems operating in the physical world, for example those which[object Object]are using signals from cameras and other sensors as an input. This paper shows[object Object]that even in such physical world scenarios, machine learning systems are[object Object]vul... |
TripletLoss with these parameters:
1{
2 "distance_metric": "TripletDistanceMetric.EUCLIDEAN",
3 "triplet_margin": 5
4}per_device_train_batch_size: 16per_device_eval_batch_size: 16num_train_epochs: 2multi_dataset_batch_sampler: round_robinoverwrite_output_dir: Falsedo_predict: Falseeval_strategy: noprediction_loss_only: Trueper_device_train_batch_size: 16per_device_eval_batch_size: 16per_gpu_train_batch_size: Noneper_gpu_eval_batch_size: Nonegradient_accumulation_steps: 1eval_accumulation_steps: Nonetorch_empty_cache_steps: Nonelearning_rate: 5e-05weight_decay: 0.0adam_beta1: 0.9adam_beta2: 0.999adam_epsilon: 1e-08max_grad_norm: 1num_train_epochs: 2max_steps: -1lr_scheduler_type: linearlr_scheduler_kwargs: {}warmup_ratio: 0.0warmup_steps: 0log_level: passivelog_level_replica: warninglog_on_each_node: Truelogging_nan_inf_filter: Truesave_safetensors: Truesave_on_each_node: Falsesave_only_model: Falserestore_callback_states_from_checkpoint: Falseno_cuda: Falseuse_cpu: Falseuse_mps_device: Falseseed: 42data_seed: Nonejit_mode_eval: Falseuse_ipex: Falsebf16: Falsefp16: Falsefp16_opt_level: O1half_precision_backend: autobf16_full_eval: Falsefp16_full_eval: Falsetf32: Nonelocal_rank: 0ddp_backend: Nonetpu_num_cores: Nonetpu_metrics_debug: Falsedebug: []dataloader_drop_last: Falsedataloader_num_workers: 0dataloader_prefetch_factor: Nonepast_index: -1disable_tqdm: Falseremove_unused_columns: Truelabel_names: Noneload_best_model_at_end: Falseignore_data_skip: Falsefsdp: []fsdp_min_num_params: 0fsdp_config: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}fsdp_transformer_layer_cls_to_wrap: Noneaccelerator_config: {'split_batches': False, 'dispatch_batches': None, 'even_batches': True, 'use_seedable_sampler': True, 'non_blocking': False, 'gradient_accumulation_kwargs': None}deepspeed: Nonelabel_smoothing_factor: 0.0optim: adamw_torchoptim_args: Noneadafactor: Falsegroup_by_length: Falselength_column_name: lengthddp_find_unused_parameters: Noneddp_bucket_cap_mb: Noneddp_broadcast_buffers: Falsedataloader_pin_memory: Truedataloader_persistent_workers: Falseskip_memory_metrics: Trueuse_legacy_prediction_loop: Falsepush_to_hub: Falseresume_from_checkpoint: Nonehub_model_id: Nonehub_strategy: every_savehub_private_repo: Falsehub_always_push: Falsegradient_checkpointing: Falsegradient_checkpointing_kwargs: Noneinclude_inputs_for_metrics: Falseinclude_for_metrics: []eval_do_concat_batches: Truefp16_backend: autopush_to_hub_model_id: Nonepush_to_hub_organization: Nonemp_parameters:auto_find_batch_size: Falsefull_determinism: Falsetorchdynamo: Noneray_scope: lastddp_timeout: 1800torch_compile: Falsetorch_compile_backend: Nonetorch_compile_mode: Nonedispatch_batches: Nonesplit_batches: Noneinclude_tokens_per_second: Falseinclude_num_input_tokens_seen: Falseneftune_noise_alpha: Noneoptim_target_modules: Nonebatch_eval_metrics: Falseeval_on_start: Falseuse_liger_kernel: Falseeval_use_gather_object: Falseaverage_tokens_across_devices: Falseprompts: Nonebatch_sampler: batch_samplermulti_dataset_batch_sampler: round_robin| Epoch | Step | Training Loss |
|---|---|---|
| 1.5974 | 500 | 0.8647 |
1@inproceedings{reimers-2019-sentence-bert,
2 title = "Sentence-BERT: Sentence Embeddings using Siamese BERT-Networks",
3 author = "Reimers, Nils and Gurevych, Iryna",
4 booktitle = "Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing",
5 month = "11",
6 year = "2019",
7 publisher = "Association for Computational Linguistics",
8 url = "https://arxiv.org/abs/1908.10084",
9}1@misc{hermans2017defense,
2 title={In Defense of the Triplet Loss for Person Re-Identification},
3 author={Alexander Hermans and Lucas Beyer and Bastian Leibe},
4 year={2017},
5 eprint={1703.07737},
6 archivePrefix={arXiv},
7 primaryClass={cs.CV}
8}